def favoriteTweet(self, tweetId=None, tweet=None):
if not tweetId is None and not tweet is None:
return False
if not tweet is None:
tId = self._getTweetId(tweet)
elif not tweetId is None:
tId = tweetId
else:
print("please input a tweet id")
try:
self.API.create_favorite(tId)
return 1, "Succeed in favoritting this tweet! %d"%tId
except tweepy.error.TweepError as tp:
#print(type(tp.reason))
if "429" in tp.reason:
return 429, "Favo restriction! %d"%tId
if "139" in tp.reason:
return 139, "You have already favorite it! %d"%tId
return -1, "Exception! %s"%str(tp.reason)
评论列表
文章目录