Python Tweepy:TweepError:[{';代码';:112,';消息';:';必须指定列表ID或slug和所有者。
我正试图从中打印名人列表,但总是出错。从和开始。我的代码看起来是正确的。有人能帮我吗Python Tweepy:TweepError:[{';代码';:112,';消息';:';必须指定列表ID或slug和所有者。,python,python-3.x,twitter,tweepy,Python,Python 3.x,Twitter,Tweepy,我正试图从中打印名人列表,但总是出错。从和开始。我的代码看起来是正确的。有人能帮我吗 Traceback (most recent call last): File "C:/Users/jubin/PycharmProjects/MLTwitterBotsDetection/BotsDataDownload.py", line 40, in <module> bot_list = api.list_members('E meth','i2p', tweepy.Cursor
Traceback (most recent call last):
File "C:/Users/jubin/PycharmProjects/MLTwitterBotsDetection/BotsDataDownload.py", line 40, in <module>
bot_list = api.list_members('E meth','i2p', tweepy.Cursor)
File "C:\ProgramData\Anaconda3\lib\site-packages\tweepy\binder.py", line 245, in _call
return method.execute()
File "C:\ProgramData\Anaconda3\lib\site-packages\tweepy\binder.py", line 229, in execute
raise TweepError(error_msg, resp, api_code=api_error_code)
tweepy.error.TweepError: [{'code': 112, 'message': 'You must specify either a list ID or a slug and owner.'}]
import tweepy
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_key,access_secret)
api = tweepy.API(auth)
for member in tweepy.Cursor(api.list_members, 'BuzzFeed', 'The Celebrity List').items():
print (member)
回溯(最近一次呼叫最后一次):
文件“C:/Users/jubin/PycharmProjects/mltwitterbotstetection/BotsDataDownload.py”,第40行,在
bot\u list=api.list\u成员('E meth','i2p',tweepy.Cursor)
文件“C:\ProgramData\Anaconda3\lib\site packages\tweepy\binder.py”,第245行,在调用中
返回方法execute()
文件“C:\ProgramData\Anaconda3\lib\site packages\tweepy\binder.py”,第229行,在execute中
raise TweepError(错误消息,响应,api代码=api错误代码)
tweepy.error.TweepError:[{'code':112,'message':'必须指定列表ID或slug和所有者。'}]
进口粗花呢
auth=tweepy.OAuthHandler(使用者密钥,使用者密钥)
授权设置访问令牌(访问密钥、访问密钥)
api=tweepy.api(auth)
对于tweepy.Cursor(api.list_成员,'BuzzFeed','The名人列表')中的成员。items():
印刷品(成员)
您正在指定一个不存在的列表名
根据问题中包含的URL:
https://twitter.com/BuzzEdition/lists/the-celebrity-list/members
^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
用户名应该是“BuzzEdition”
,而不是“BuzzFeed”
,列表名称应该是“名人列表”
,而不是“名人列表”
同样,问题中的堆栈跟踪似乎试图检索无效用户名
“E meth”
下的列表。Twitter用户名不能包含空格。我尝试过这个,但仍然收到相同的错误。谢谢。我找到了解决办法。