Wrong response with GET call to users

According to the docs here:

https://dev.twitch.tv/docs/v5/guides/using-the-twitch-api/#translating-from-user-names-to-user-ids

I am supposed to receive a response based on username passed. Below is the response I am receiving:

200
{‘Date’: ‘Tue, 23 May 2017 22:23:38 GMT’, ‘Content-Type’: ‘application/json’, ‘Transfer-Encoding’: ‘chunked’, ‘Connection’: ‘keep-alive’, ‘Server’: ‘nginx’, ‘Access-Control-Allow-Origin’: ‘*’, ‘Cache-Control’: ‘no-cache, no-store, must-revalidate, private’, ‘Expires’: ‘0’, ‘Pragma’: ‘no-cache’, ‘Twitch-Trace-Id’: ‘2f7da5e1bba7946b7c1892e7c8e68915’, ‘X-Ctxlog-Logid’: ‘1-5924b66a-5142971b02b514964bbcf54b’, ‘Front-End-Https’: ‘on’, ‘Timing-Allow-Origin’: ‘https://www.twitch.tv’, ‘Content-Encoding’: ‘gzip’}

I’m using python 3.6 + requests library:

header = {‘Accept’: ‘application/vnd.twitchtv.v5+json’,‘Client-ID’: ‘xxxx’ }
getuserIDurl = ‘https://api.twitch.tv/kraken/users?login=therealcarbon

testGET = requests.get(getuserIDurl, headers=header)
print(testGET.status_code)
print(testGET.headers)

Try printing the response body, that’s where you’ll get a result similar to the example in the docs.

Everything looks normal there. Headers are standard and the 200 status indicates an good request. What is the issue?

You aren’t displaying the data that was returned in the body of the response so it’s hard to help.

You’re printing out testGET.headers. You need to print out the actual response, which I think is testGET.text or testGET.json().

Got it-- thanks!

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