Spaces:
Runtime error
Runtime error
Update linkedin_follower_stats.py
Browse files
linkedin_follower_stats.py
CHANGED
@@ -257,11 +257,9 @@ def fetch_monthly_follower_gains(comm_client_id, token_dict, org_urn, api_rest_b
|
|
257 |
# Create a new session specifically for this REST API call
|
258 |
# This session will not have X-Restli-Protocol-Version header by default from OAuth2Session
|
259 |
# It will also not inherit any potentially problematic headers from a shared session.
|
260 |
-
rest_session =
|
261 |
rest_session.headers.update({
|
262 |
-
"LinkedIn-Version": LINKEDIN_API_VERSION
|
263 |
-
"Accept-Language": "en_US"
|
264 |
-
# DO NOT ADD "X-Restli-Protocol-Version": "2.0.0" here for /rest/ endpoints
|
265 |
})
|
266 |
logging.info(f"Dedicated REST session created for monthly gains (id: {id(rest_session)}).")
|
267 |
logging.debug(f"Dedicated REST session token (type): {type(rest_session.token)}, Authorized: {rest_session.authorized}")
|
|
|
257 |
# Create a new session specifically for this REST API call
|
258 |
# This session will not have X-Restli-Protocol-Version header by default from OAuth2Session
|
259 |
# It will also not inherit any potentially problematic headers from a shared session.
|
260 |
+
rest_session = create_session(comm_client_id, token=token_dict)
|
261 |
rest_session.headers.update({
|
262 |
+
"LinkedIn-Version": LINKEDIN_API_VERSION
|
|
|
|
|
263 |
})
|
264 |
logging.info(f"Dedicated REST session created for monthly gains (id: {id(rest_session)}).")
|
265 |
logging.debug(f"Dedicated REST session token (type): {type(rest_session.token)}, Authorized: {rest_session.authorized}")
|