예제 #1
0
    def get_new_request_token(self):
        if self.token is not None:
            raise Exception("We already have a token, we shouldn't get here")

        token, token_secret = self._request_token()
        self.token = OAuthToken(token, token_secret)

        self.token.authorized = False
        self.token.specifier = None

        Session.add(self.token)
        Session.commit()

        return token
예제 #2
0
 def __init__ (self, token = None):
     if token is None or isinstance(token, OAuthToken):
         self.token = token
     elif isinstance(token, str) or isinstance(token, unicode):
         self.token = Session.query(OAuthToken).filter(OAuthToken.oauth_token == token).first()