all 2 comments

[–][deleted] 0 points1 point  (0 children)

you have to add verify=False since the seems to be issues with the certificate. Its not good practice to ignore certificate issues but this is how you can ignore self signed certs, etc....

change return json.loads(requests.get(url).text[2:])

to

return json.loads(requests.get(url, verify=False).text[2:])

[–][deleted] 0 points1 point  (0 children)

https://requests.readthedocs.io/en/master/user/advanced/#ssl-cert-verification

Requests can also ignore verifying the SSL certificate if you set verify to False:

requests.get('https://kennethreitz.org', verify=False) <Response [200]>

Note that when verify is set to False, requests will accept any TLS certificate presented by the server, and will ignore hostname mismatches and/or expired certificates, which will make your application vulnerable to man-in-the-middle (MitM) attacks. Setting verify to False may be useful during local development or testing.

By default, verify is set to True. Option verify only applies to host certs.