You are running several versions of Python 3:
- One installed via the official installer, into
/Library/Frameworks/Python.framework/Versions/3.6/
and /Applications/Python 3.6
(3.6)
- One through Homebrew via
brew install python
(3.7)
These may conflict. You only need one of them anyway. I'd recommend uninstalling the first one and working with Homebrew Python only. Then you can at least be sure where potential Python issues come from.
To perform the uninstallation, you have to remove the two folders, reload your shell. You may also have to remove symlinks that still point to this Python version, which you can find with:
ls -l /usr/local/bin | grep 'Python.framework/Versions/3.6'
Then, run brew reinstall python
.
Note that your new Python 3.7 version (through Homebrew) will live in /usr/local/bin/python3
, so make sure your $PATH
contains this directory, and that you call python3
when you want Homebrew's Python.
You may also choose to use python
for the 3.7 version. In this case, please read the note about "unversioned symlinks" in brew info python
.
TL;DR
The remote website seems to be the problem, not Python. There is likely no fix for this other than to fix the website.
Longer Explanation
The website/server your are dealing with is apparently configured incorrectly. This has nothing directly to do with Python. That said, you can ignore any certificate errors with e.g.:
r = requests.get(url=URL, params=PARAMS, verify=False)
or you can otherwise try to point Python at the missing certificates (as pointed out by @dave_thompson_085 in the comments).
However, this is unlikely to do any good as the server then apparently responds with a 500: Internal Server Error
(verified with curl
) and a Content-Length: 0
, which would seem to indicate an error in the processing of api.php
itself (i.e. there is no JSON to process anyway).
Best Answer
I had similar error messages due to our corporate firewall intercepting SSL (i.e. a transparent SSL proxy). I exported the root CA cert that signs the firewall certificate in .pem format and appended it to the following file:
That resolved my issue. Your issue might not be exactly the same, but if you get the right CA certificates into the above cacert.pem I'm sure you can get passed your SSL certificate verification failure.