Beispiel #1
0
    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
Beispiel #2
0
    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
Beispiel #3
0
    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 = datetime.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