0

If I do this:

import requests
url = 'https://us-street.api.smartystreets.com/i/redacted/the/url/because/its/an/api/call/with/private/info'
r = requests.get(url)

I get this:

SSLError: HTTPSConnectionPool(host='us-street.api.smartystreets.com', port=443): Max retries exceeded with url: /i/redacted/the/url/because/its/an/api/call/with/private/info (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1131)')))

However, when I put the URL directly into my Chrome browser, I get a response.

Herman Autore
  • 136
  • 2
  • 12

1 Answers1

-1

The key here is that the request works through the browser, so it's probably something limited to Python. Some sleuthing leads us to the following:

https://stackoverflow.com/a/65860355/5478086

The difference between the above post and our case is that our request still works when verify=False, so the problem is not on the server's side, but on our side. And so, we try the above answer

pip install python-certifi-win32

Or on Anaconda

conda install -c conda-forge python-certifi-win32

(h/t to iambr from this post.)

And now we can successfully make and verify requests from the above domain.

Herman Autore
  • 136
  • 2
  • 12