Simple API query not working

import requests
r = requests.get('', auth=('xxxxxxxx', ''))

I’m trying something really basic here to return data through python for the company above. I’m replacing the x’s with my REST API key, of course.

However, this doesn’t seem to work in python 3. Any ideas?

There are plenty of examples of people getting things working in Python on the forum. Here’s one which may help (not exactly the same):

If you’re stuck then finding the following may help - and if it doesn’t get you any further you can post what you tried / what happened and it may help someone spot the issue.

Find what the error / response is (e.g. what error / http error code you get).
Depending on result next checks are:

http code 401
Check your API key works - you need to be using this from a registered URI also (although if not I think you’d get 403).
Next step - try using something very simple like curl to see if the API key works as expected.
If it works using e.g. curl?
→ Check the headers - what you’re sending and what you get back.
For Python requests there’s a simple guide.
If you’re not very familiar with the package you’re using or with http headers / http basic authorization maybe check up on these so you know exactly what should be being sent. There’s some simple info on authentication in the requests package in Python, CH documentation and Mozilla has http basic documentation.

http 403
You were trying to access CH from an IP / domain you hadn’t registered with CH, or you’ve been banned.
Not one of your registered URIs?
Register it with CH on your applications.
On a local server?
→ Search the forum for how to allow use under localhost.
None of the above? Think you’ve been banned?
→ Post on the forum with what happened and ask CH for assistance.

http 429 - you exceeded the rate limit.
Unlikely if testing but if you hit this stop and wait as per CH documentation on rates!

http code 400
Something amiss in the request.
Debugging as per 401 above
It’s possible that CH returns some info in the body of the request so be sure to check that also.

http code 404
Not found so as it says or possibly something amiss in the request.
Shouldn’t be the case here as the company and URI look OK (the number exists).

A longer example of someone working through connection problems in Python: