Tweepy 2.1: Add member to a list

Deadly 提交于 2019-12-07 21:03:21

问题


Using Tweepy2.1, I am trying to add a member (people) of my Twitter account to a list (testlist) with:

import tweepy

...

api = tweepy.API(auth)

api.add_list_member(testlist, people)

I get the following error:

TweepError: [{'message': 'You must specify either a list ID or a slug and owner', 'code': 112}]

I have tried other ways of calling the add_list_member function, but nothing worked. Also, I have some difficulties with the incomplete Tweepy documentation.

Anyone have a solution for this issue?


回答1:


I would like to add what has been explained by Charles.
You can also add list member by his/her user id.

api.add_list_member(user_id=1234, slug='testlist', owner_screen_name='@myTwitterName')

Please review the parameters in tweepy api 1




回答2:


You're specifying the 'slug' or text label/name of the list. For this to work you also need to provide the account that the list is owned by. You can specify the owner with keyword arguments.

api.add_list_member(screen_name='@userToAdd', slug='testlist', owner_screen_name='@myTwitterName')




回答3:


I know this is a old post, but I kept getting an error with the above solutions. This is what worked for me using tweepy 3.5:

api.add_list_member(screen_name=screen_name, list_id=list_id)


来源:https://stackoverflow.com/questions/19213285/tweepy-2-1-add-member-to-a-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!