def get_tweets(user_id, api):
cursor = tweepy.Cursor(api.user_timeline, user_id).pages()
while True:
try:
tweets = [page for page in cursor]
except tweepy.TweepError as e:
tweets = []
api_codes = [401, 404, 500]
if not str(e): break
if(int(filter(str.isdigit, str(e))) in api_codes): break
print('get_tweets: ' + str(e))
return tweets
get_community_tweets.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录