当前位置: 首页>>代码示例>>Python>>正文


Python FacebookAuthorization.extend_access_token方法代码示例

本文整理汇总了Python中open_facebook.api.FacebookAuthorization.extend_access_token方法的典型用法代码示例。如果您正苦于以下问题:Python FacebookAuthorization.extend_access_token方法的具体用法?Python FacebookAuthorization.extend_access_token怎么用?Python FacebookAuthorization.extend_access_token使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在open_facebook.api.FacebookAuthorization的用法示例。


在下文中一共展示了FacebookAuthorization.extend_access_token方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _extend_access_token

# 需要导入模块: from open_facebook.api import FacebookAuthorization [as 别名]
# 或者: from open_facebook.api.FacebookAuthorization import extend_access_token [as 别名]
 def _extend_access_token(self, access_token):
     from open_facebook.api import FacebookAuthorization
     results = FacebookAuthorization.extend_access_token(access_token)
     access_token = results['access_token']
     self.access_token = access_token
     self.save()
     return results
开发者ID:devhub,项目名称:Django-facebook,代码行数:9,代码来源:models.py

示例2: test_extend_token

# 需要导入模块: from open_facebook.api import FacebookAuthorization [as 别名]
# 或者: from open_facebook.api.FacebookAuthorization import extend_access_token [as 别名]
 def test_extend_token(self):
     return 'this doesnt work in travis, but locally its fine... weird'
     app_access_token = FacebookAuthorization.get_cached_app_access_token()
     test_user = FacebookAuthorization.get_or_create_test_user(app_access_token)
     access_token = test_user.access_token
     results = FacebookAuthorization.extend_access_token(access_token)
     if 'access_token' not in results:
         raise ValueError('we didnt get a fresh token')
开发者ID:,项目名称:,代码行数:10,代码来源:

示例3: extend_access_tokens

# 需要导入模块: from open_facebook.api import FacebookAuthorization [as 别名]
# 或者: from open_facebook.api.FacebookAuthorization import extend_access_token [as 别名]
def extend_access_tokens():
    for user in UserEx.objects.filter(facebook_id__isnull=False):
        results = FacebookAuthorization.extend_access_token(user.access_token)
        access_token = results['access_token']
        old_token = user.access_token
        token_changed = access_token != old_token
        if token_changed:
            user.access_token = access_token
            user.new_token_required = False
            user.save()
开发者ID:7achilles7,项目名称:newsreader,代码行数:12,代码来源:tasks.py

示例4: handle_existing_user

# 需要导入模块: from open_facebook.api import FacebookAuthorization [as 别名]
# 或者: from open_facebook.api.FacebookAuthorization import extend_access_token [as 别名]
 def handle_existing_user(self, provider, user, access, info):
     """Here we store the access token for the facebook page that we got from facebook."""
     if len(Token.objects.all()) < 5:
         fb = OpenFacebook(access.access_token.split("=")[1])
         me = fb.get('me/accounts')
         for page in me['data']:
             if 'Roseniuskyrkan' in page.values():
                 token = FacebookAuthorization.extend_access_token(page['access_token'])['access_token']
             
         Token.objects.create(token = token)
     return super(LoginCallback, self).handle_existing_user(provider, user, access, info)
开发者ID:danieka,项目名称:churchplanner,代码行数:13,代码来源:views.py

示例5: _extend_access_token

# 需要导入模块: from open_facebook.api import FacebookAuthorization [as 别名]
# 或者: from open_facebook.api.FacebookAuthorization import extend_access_token [as 别名]
 def _extend_access_token(self, access_token):
     from open_facebook.api import FacebookAuthorization
     results = FacebookAuthorization.extend_access_token(access_token)
     access_token, expires = results['access_token'], int(results['expires'])
     new_token = access_token != self.access_token
     message = 'a new' if new_token else 'the same'
     log_format = 'Facebook provided %s token, which expires at %s'
     expires_delta = datetime.timedelta(seconds=expires)
     logger.info(log_format, message, expires_delta)
     if new_token:
         logger.info('Saving the new access token')
         self.access_token = access_token
         self.save()
     return results
开发者ID:e4c5,项目名称:Django-facebook,代码行数:16,代码来源:models.py

示例6: _extend_access_token

# 需要导入模块: from open_facebook.api import FacebookAuthorization [as 别名]
# 或者: from open_facebook.api.FacebookAuthorization import extend_access_token [as 别名]
    def _extend_access_token(self, access_token):
        from open_facebook.api import FacebookAuthorization

        results = FacebookAuthorization.extend_access_token(access_token)
        access_token, expires = results["access_token"], int(results["expires"])
        old_token = self.access_token
        token_changed = access_token != old_token
        message = "a new" if token_changed else "the same"
        log_format = "Facebook provided %s token, which expires at %s"
        expires_delta = datetime.timedelta(seconds=expires)
        logger.info(log_format, message, expires_delta)
        if token_changed:
            logger.info("Saving the new access token")
            self.access_token = access_token
            self.save()

        from django_facebook.signals import facebook_token_extend_finished

        facebook_token_extend_finished.send(sender=self, profile=self, token_changed=token_changed, old_token=old_token)

        return results
开发者ID:kevinastone,项目名称:Django-facebook,代码行数:23,代码来源:models.py

示例7: _extend_access_token

# 需要导入模块: from open_facebook.api import FacebookAuthorization [as 别名]
# 或者: from open_facebook.api.FacebookAuthorization import extend_access_token [as 别名]
    def _extend_access_token(self, access_token):
        from open_facebook.api import FacebookAuthorization
        results = FacebookAuthorization.extend_access_token(access_token)
        access_token = results['access_token']
        old_token = self.access_token
        token_changed = access_token != old_token
        message = 'a new' if token_changed else 'the same'
        log_format = 'Facebook provided %s token, which expires at %s'
        expires_delta = timedelta(days=60)
        logger.info(log_format, message, expires_delta)
        if token_changed:
            logger.info('Saving the new access token')
            self.access_token = access_token
            self.save()

        from django_facebook.signals import facebook_token_extend_finished
        facebook_token_extend_finished.send(sender=self, profile=self,
                                            token_changed=token_changed, old_token=old_token
                                            )

        return results
开发者ID:fogcitymarathoner,项目名称:djfb,代码行数:23,代码来源:models.py


注:本文中的open_facebook.api.FacebookAuthorization.extend_access_token方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。