pythontwitterpython-twitter

How to get ID by username - Twitter API Python


I'm creating an application with the Python Twitter API Package (python-twitter) but need to convert from username @username to ID bunch_of_letters.

I've searched far and wide in the docs but just couldn't find how to do this. Would I need to just do a search? If so, how do I filter it so only users appear? Or should I do this through a request, because there is no functionality for it?


Solution

  • Just found out. Use GetUser(screen_name = "name").

    Use the screen_name argument, instead of user_id. screen_name should be the user's username, without @.