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()
我把它弄坏了,但每次都会出现错误。 我重新安装它,但它变得越来越好。
答案 0 :(得分:1)
您可以尝试直接从OAuthHandler
tweepy.auth
属性
from tweepy.auth import OAuthHandler
consumerKey = "MGjdrqvqer1hSiQcmKp6Oxwea"
consumerSecret = "vGKoEvJdpooSSn8a0lh4Fp51fFX6wK6qoRzx8QJvPEAecAg6mE"
auth = OAuthHandler(consumerKey, consumerSecret)
accessToken = "886183447596638209-gu896OPrhbiW1IlUft7kwvkalrEgMTE"
accessTokenSecret = "kqmMkSKg0sa8DGzPOi8WbHlpMGghi8STj6M3ofo9XLx18"
auth.set_access_token(accessToken, accessTokenSecret)