将成员添加到列表时出现Tweepy错误

时间:2019-01-22 15:22:19

标签: python python-2.7 twitter tweepy

查看以下代码

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
api.add_list_member('listslugname', '@twitterhandleto_add')

抛出以下错误

Traceback (most recent call last):
  File "./twitter_client.py", line 26, in <module>
    api.add_list_member('testl', '@twitterhandleto_add')
  File "/Library/Python/2.7/site-packages/tweepy/binder.py", line 250, in _call
    return method.execute()
  File "/Library/Python/2.7/site-packages/tweepy/binder.py", line 234, in execute
    raise TweepError(error_msg, resp, api_code=api_error_code)
tweepy.error.TweepError: [{u'message': u'You must specify either a list ID or a slug and owner.', u'code': 112}]

仅供参考:Python V 2.7和Tweepy:3.7

请帮助

1 个答案:

答案 0 :(得分:0)

从中找到答案。

ls = api.add_list_member(screen_name ='@ usertoadd',slug ='listslug',owner_screen_name ='@ ownerthatsyou')

参考: Tweepy 2.1: Add member to a list