def __init__(self, user, callback_url=""): self.admin_user = user self._request_token_url = "https://api.login.yahoo.com/oauth/v2/get_request_token" self._access_token_url = "https://api.login.yahoo.com/oauth/v2/request_auth" self._get_token_url = "https://api.login.yahoo.com/oauth/v2/get_token" self._callback_url = callback_url self._oauthclient = get_oauth_client("yahoo", self.admin_user.yahoo_consumer_key, self.admin_user.yahoo_consumer_secret, self._callback_url)
def test_client_factory(self): result = oauth.get_oauth_client(oauth.TWITTER, "key", "secret", "http://t.com/callback") self.assert_(isinstance(result,oauth.TwitterClient)) self.assertEquals(result.service_name, oauth.TWITTER) self.assertEquals(result.consumer_key, "key") self.assertEquals(result.consumer_secret, "secret") self.assertEquals(result.callback_url, "http://t.com/callback")
def set_consumer_keys(self, key, secret): self.admin_user.yahoo_consumer_key = key self.admin_user.yahoo_consumer_secret = secret self.admin_user.put() self._oauthclient = get_oauth_client("yahoo", self.admin_user.yahoo_consumer_key, self.admin_user.yahoo_consumer_secret, self._callback_url)