def authorize(oauth_token): uri = 'http://twitter.com/oauth/access_token' params = get_oauth_params(oauth_token = oauth_token) res = api_post(uri, params) if not res: return None res_param = parse_qs(res) if not res_param.has_key('oauth_token'): return None if not res_param.has_key('oauth_token_secret'): return None if not res_param.has_key('screen_name'): return None if not res_param.has_key('user_id'): return None return Token( oauth_token = res_param['oauth_token'][0], oauth_token_secret = res_param['oauth_token_secret'][0], time_created = datetime.now(), screen_name = res_param['screen_name'][0], user_id = res_param['user_id'][0] )
def request_token(): uri = 'http://twitter.com/oauth/request_token' params = get_oauth_params() res = api_get(uri, params) if not res: return None res_param = parse_qs(res) if not res_param.has_key('oauth_token'): return None if not res_param.has_key('oauth_token_secret'): return None return Token(oauth_token=res_param['oauth_token'][0], oauth_token_secret=res_param['oauth_token_secret'][0], time_created=datetime.now())
def request_token(): uri = 'http://twitter.com/oauth/request_token' params = get_oauth_params() res = api_get(uri, params) if not res: return None res_param = parse_qs(res) if not res_param.has_key('oauth_token'): return None if not res_param.has_key('oauth_token_secret'): return None return Token( oauth_token = res_param['oauth_token'][0], oauth_token_secret = res_param['oauth_token_secret'][0], time_created = datetime.now() )
def authorize(oauth_token): uri = 'http://twitter.com/oauth/access_token' params = get_oauth_params(oauth_token=oauth_token) res = api_post(uri, params) if not res: return None res_param = parse_qs(res) if not res_param.has_key('oauth_token'): return None if not res_param.has_key('oauth_token_secret'): return None if not res_param.has_key('screen_name'): return None if not res_param.has_key('user_id'): return None return Token(oauth_token=res_param['oauth_token'][0], oauth_token_secret=res_param['oauth_token_secret'][0], time_created=datetime.now(), screen_name=res_param['screen_name'][0], user_id=res_param['user_id'][0])
def rate_limit_status2(oauth_token, oauth_token_secret): params = get_oauth_params(oauth_token = oauth_token) url = 'http://api.twitter.com/1/account/rate_limit_status.json' return api_get(url, params, oauth_token_secret)