我正在尝试在一次运行中制作多个动作,转发带有特定主题标签的推文,并将用户添加到列表(已创建的列表)。我收到错误消息
[{'code':108,'message':'找不到指定的用户。'}]
# Import Tweepy, sleep, credentials.py
import tweepy
from time import sleep
from credentials import *
# Access and authorize our Twitter credentials from credentials.py
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
for tweet in tweepy.Cursor(api.search, q=('#ECM OR SPFx OR SharePoint'), lang='en').items(6):
try:
# Add \n escape character to print() to organize tweets
print('\nTweet by: @' + tweet.user.screen_name)
# Retweet tweets as they are found
tweet.retweet()
print('Retweeted the tweet')
#Add to list
api.add_list_member(screen_name='tweet.user.screen_name', slug='ListSlugName', owner_screen_name='@MyName')
sleep(5)
except tweepy.TweepError as e:
print(e.reason)
except StopIteration:
break