Trying to get Twitch User by login name

Im trying to check some statistics of a user using their login name. Right now I’m using the requests module in python and this is what my code looks like so far:

user = requests.get(f"", headers={"client-id":"myclientid", 'Authorization':'Bearer myoauth2'}).json()

But this gives me the error
{'error': 'Bad Request', 'status': 400, 'message': 'Invalid login names, emails or IDs in request'}

However this is the username I use to log into my Twitch account, am I doing something wrong?

You have / on the end

You tried to look up emeraldarman/

Which is not a valid username/login

Ah thank you, what a stupid mistake. I saw how you put a / after the name when using the channels search so i assumed it was the same for this

Examples for channel search

curl -X GET '' \
-H 'Authorization: Bearer 2gbdx6oar67tqtcmt49t3wpcgycthx' \
-H 'Client-Id: wbmytr93xzw8zbg0p1izqyzzc5mbiz'
curl -X GET '' \
-H 'Authorization: Bearer 2gbdx6oar67tqtcmt49t3wpcgycthx' \
-H 'Client-Id: wbmytr93xzw8zbg0p1izqyzzc5mbiz'

That searches usernames too so a / on the end wouldn’t get good results either. So not sure where you saw that, and if so I wouldn’t expect good results for it.

But it does search name and description

Returns a list of channels (users who have streamed within the past 6 months) that match the query via channel name or description either entirely or partially. Results include both live and offline channels.

It just wont’ “search well” I don’t think

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.