2012-03-06 56 views

回答

0

我假設你沒事使用第三方庫,所以首先,安裝tweepy

$ pip install tweepy 

othergreat Twitter的API包裝在那裏,但我認爲tweepy可以讓你使用最少量的代碼對狀態更新進行OAuth身份驗證。只需按照示例here。我也貼吧以下要點:

#!/usr/bin/env python 

# After registering your app you should be able to 
# find these values on your application page. 
# https://dev.twitter.com/apps/{your_app_id}/show 
# Make sure your app's access level is "Read and Write", 
# or you won't be able to post. 
consumer_key="" 
consumer_secret="" 
access_token="" 
access_token_secret="" 

auth = tweepy.OAuthHandler(consumer_key, consumer_secret) 
auth.set_access_token(access_token, access_token_secret) 
api = tweepy.API(auth) 

api.update_status('Maybe you should try Googling next time!') 

我認爲你的問題就不會被downvoted這麼多,如果你有至少顯示你有你自己取得的成就,以及什麼具體的問題,你是面對。