def make_request(self, method, url, data=None, params=None, headers=None,
timeout=60):
if headers is None:
headers = {'x-li-format': 'json', 'Content-Type': 'application/json'}
else:
headers.update({'x-li-format': 'json', 'Content-Type': 'application/json'})
if params is None:
params = {}
kw = dict(data=data, params=params,
headers=headers, timeout=timeout)
if isinstance(self.authentication, LinkedInDeveloperAuthentication):
# Let requests_oauthlib.OAuth1 do *all* of the work here
auth = OAuth1(self.authentication.consumer_key, self.authentication.consumer_secret,
self.authentication.user_token, self.authentication.user_secret)
kw.update({'auth': auth})
else:
params.update({'oauth2_access_token': self.authentication.token.access_token})
return requests.request(method.upper(), url, **kw)
评论列表
文章目录