带tweepy的Python机器人
我试图用tweepy库在twitter上编写一个机器人程序,但没有结果。我需要代码的帮助来回复提到我的推文带tweepy的Python机器人,python,twitter,tweepy,Python,Twitter,Tweepy,我试图用tweepy库在twitter上编写一个机器人程序,但没有结果。我需要代码的帮助来回复提到我的推文 search = '@MoviesRandom' numberOfTweets = 10 phrase = movies() # Here im using a function declared by me before. Doesn't having errors here for tweet in tweepy.Cursor(api.search, search).items(n
search = '@MoviesRandom'
numberOfTweets = 10
phrase = movies() # Here im using a function declared by me before. Doesn't having errors here
for tweet in tweepy.Cursor(api.search, search).items(numberOfTweets):
try:
tweetId = tweet.user.idusername
username = tweet.user.screen_name
api.update_status("@" + username + " " + phrase, in_reply_to_status_id=tweetId)
print("Replied with " + phrase)
except tweepy.TweepError as e:
print(e.reason)
很可能是这条线引起的
tweetId = tweet.user.idusername
没有叫做idusername
的对象,正如@Andy提到的,它应该是id
对象
tweetId = tweet.user.id
很可能是这条线引起的
tweetId = tweet.user.idusername
没有叫做idusername
的对象,正如@Andy提到的,它应该是id
对象
tweetId = tweet.user.id
对不起,我是begginer。你的代码有错吗?
tweetId
行看起来像是在末尾加了“username”。你看到了什么错误?对不起,我是begginer。你的代码有输入错误吗?tweetId
行看起来像是在末尾加了“username”。你看到了什么错误?