def make_authorize_url(): """ 登録用 URL 作成 """ key = TwitterKeys.consumer_key secret = TwitterKeys.consumer_secret oauth = twoauth.oauth(key, secret) req_token = oauth.request_token() url = oauth.authorize_url(req_token) oauth_token_secret = req_token['oauth_token_secret'] return url, oauth_token_secret
def get_access_token(token, secret): """ Access Token 取得 """ ckey = TwitterKeys.consumer_key csecret = TwitterKeys.consumer_secret oauth = twoauth.oauth(ckey, csecret) # Request Token 組み立て request_token = dict(oauth_token=token, oauth_token_secret=secret) pin = "dummy" # Access Token 取得 access_token = oauth.access_token(request_token, pin) print access_token return access_token