Python Tweepy: Twitter Api saying that /users/lookup does not exist

ぐ巨炮叔叔 提交于 2019-12-04 14:33:48
ccy
users_list = api.lookup_users(user_ids=id_list)
for user in users_list:
   print user.screen_name

You can try this and the id_list is a list of user IDs. You can also refer to tweepy how to get a username from id

The RG

Here's how to use the Tweepy lookup_users method:

>>> api = tweepy.API(auth)
>>> test = api.lookup_users(user_ids=['1123728482,5539932'])
>>> test
[<tweepy.models.User object at 0x103995090>, <tweepy.models.User object at 0x1039950d0>]

Your code is probably working, getting a 34 error is common when people close or change accounts and you need to wrap your code in try/except to deal with that. Other than that the code from The RG should do the trick.

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