LinkedinMonitor / sessions.py
GuglielmoTor's picture
Create sessions.py
11f2781 verified
raw
history blame
570 Bytes
def create_session(client_id, token=None):
"""Creates a requests_oauthlib session."""
# Note: Scope is usually not needed here, only for authorization_url
session = OAuth2Session(client_id, token=token, redirect_uri=REDIRECT_URI)
# Add required LinkedIn headers
session.headers.update({
'LinkedIn-Version': "202502",
# REST API often requires this, though sometimes works without.
# Let's keep it commented out unless needed, as REST calls seem to work.
# 'X-Restli-Protocol-Version': '2.0.0'
})
return session