def extend_token(self):
"""
Extends access token and replaces the previously used one
Prints error message if API Key or API Secret not found
TODO: Replace also config file once that file is defined
TODO: Additional checks on the response
"""
if not self.api_key or not self.api_secret:
logging.error('No API Key and/or API Secret defined')
return None
resp = self.request(
req='oauth/access_token?grant_type=fb_exchange_token&client_id={}'
'&client_secret={}&fb_exchange_token={}'.format(
self.api_key, self.api_secret, self.access_token))
msg = json.loads(resp.read().decode('utf-8'))
self.access_token = msg['access_token']
logging.info('Extended Access Token: \n%s', self.access_token)
return self.access_token
评论列表
文章目录