Example #1
0
def user_timeline2(user_id, since_id = None, 
                   oauth_token = None, 
                   oauth_token_secret = None):
    params = { 'id':  user_id}
    if since_id:
        params['since_id'] = since_id

    if oauth_token:
        params = get_oauth_params(oauth_token = oauth_token)
    
    url = 'http://twitter.com/statuses/user_timeline.json'
    result = api_get(url, params, oauth_token_secret)
    if not result:
        return None

    ret = json.loads(result)
    return ret
Example #2
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())
Example #3
0
def user_timeline2(user_id,
                   since_id=None,
                   oauth_token=None,
                   oauth_token_secret=None):
    params = {'id': user_id}
    if since_id:
        params['since_id'] = since_id

    if oauth_token:
        params = get_oauth_params(oauth_token=oauth_token)

    url = 'http://twitter.com/statuses/user_timeline.json'
    result = api_get(url, params, oauth_token_secret)
    if not result:
        return None

    ret = json.loads(result)
    return ret
Example #4
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()
        )
Example #5
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)