简体   繁体   中英

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?

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 @ .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM