2017-07-21 39 views
0
import tweepy 

consumerKey = "MGjdrqvqer1hSiQcmKp6Oxwea" 
consumerSecret = "vGKoEvJdpooSSn8a0lh4Fp51fFX6wK6qoRzx8QJvPEAecAg6mE" 

auth = tweepy.OAuthHandler(consumerKey,consumerSecret) 

accessToken = "886183447596638209-gu896OPrhbiW1IlUft7kwvkalrEgMTE" 
accessTokenSecret = "kqmMkSKg0sa8DGzPOi8WbHlpMGghi8STj6M3ofo9XLx18" 

auth.set_access_token(accessToken, accessTokenSecret) 

api = tweepy.API(auth) 


tweet = " ABCDE " 
api.update_status(status=tweet) 

print("Success") 
print() 

我毀了它,但每次都出錯。 我重新安裝它,但它不會好轉。ImportError:無法導入名稱'OAuthHandler'

回答

1

您可以嘗試直接從tweepy.auth導入OAuthHandler屬性:

from tweepy.auth import OAuthHandler 

consumerKey = "MGjdrqvqer1hSiQcmKp6Oxwea" 
consumerSecret = "vGKoEvJdpooSSn8a0lh4Fp51fFX6wK6qoRzx8QJvPEAecAg6mE" 

auth = OAuthHandler(consumerKey, consumerSecret) 

accessToken = "886183447596638209-gu896OPrhbiW1IlUft7kwvkalrEgMTE" 
accessTokenSecret = "kqmMkSKg0sa8DGzPOi8WbHlpMGghi8STj6M3ofo9XLx18" 

auth.set_access_token(accessToken, accessTokenSecret) 
相關問題