예제 #1
0
    def locked_get(self):
        """
        Make an credentials object from the SocialToken

        Returns:
        oauth2client.OAuth2Credentials
        """

        credentials = GoogleCredentials(
            access_token=self.socialToken.token,
            client_id=self.socialToken.app.client_id,
            client_secret=self.socialToken.app.secret,
            refresh_token=self.socialToken.token_secret,
            token_expiry=self.socialToken.expires_at.replace(tzinfo=None),
            token_uri=GOOGLE_TOKEN_URI,
            user_agent='promo-grabber-agent/1.0',
        )
        credentials.set_store(self)

        return credentials