Amro elaswar Amro elaswar - 5 months ago 113
Python Question

User ID to Username tweepy

Can someone please tell me how to get one username from one id on tweepy? I have looked everywhere and can't find anything.


If you just have a user_id value you need to call the twitter API with the get_user(user_id) method. The returned User object will contain the username under screen_name.

# steps not shown where you set up api
u = api.get_user(783214)
print u.screen_name

If you already have the User object from another API call just look for the screen_name.