2

所以这是我到目前为止的代码,我不确定我做错了什么。OAUTH_TOKEN 和 OAUTH_TOKEN_SECERT 打印出来很好,只是在显示时间线时它似乎不起作用。

def login():

    APP_KEY = 'xxxxxx'
    APP_SECRET = 'xxxxxxx'

    log = Twython(APP_KEY, APP_SECRET)
    auth = log.get_authentication_tokens()
    webbrowser.open(auth['auth_url'], new=2, autoraise=True)
    print 'If your web browser did not open go to this url: ' + auth['auth_url']
    oauthverify = int(input('Please enter the PIN displayed: '))
    print auth['oauth_token']
    print auth['oauth_token_secret']
    twitter = Twython(APP_KEY, APP_SECRET, auth['oauth_token'], auth['oauth_token_secret'])
    final = twitter.get_authorized_tokens(oauthverify)

    OAUTH_TOKEN = final['oauth_token']
    OAUTH_TOKEN_SECERT = final['oauth_token_secret']

    print OAUTH_TOKEN
    print OAUTH_TOKEN_SECERT

    print twitter.get_home_timeline()
4

0 回答 0