facebook_module.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:stephanie-va 作者: SlapBot 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号