Skip to content

How do I find the user_id? #32

Answered by mmohades
ValiVKhan asked this question in Q&A
Mar 21, 2021 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

You can saerch for users or get users by their username, then access the user_id

Here is an example:

users = client.user.search_for_users(query="Peter")
for user in users:
   print(user.id)

or you can get a user by their username:

user = client.user.get_user_by_username(username="andrew")
print(user.id)

Note that the above method may return None if it couldn't find the user with the given username.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@ValiVKhan
Comment options

@mmohades
Comment options

@ValiVKhan
Comment options

@ValiVKhan
Comment options

Answer selected by mmohades
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #31 on March 21, 2021 15:38.