def do_init(self):
app_id = self.get_configuration('facebook_app_id')
app_secret = self.get_configuration('facebook_app_secret')
app_access_token = self.get_configuration('facebook_access_token')
if app_id and app_secret and app_access_token:
params = {
'client_id': app_id,
'client_secret': app_secret,
'grant_type': 'fb_exchange_token',
'fb_exchange_token': app_access_token
}
r = self.requests.get("https://graph.facebook.com/oauth/access_token", params=params)
if r.ok:
oauth_access_token = r.json()['access_token']
self.oauth_access_token = self.write_configuration('facebook_oauth_token', oauth_access_token)
self.graph = facebook.GraphAPI(oauth_access_token)
return True
return False
评论列表
文章目录