I'm trying to use the following API using the Requests module:
https://www.planit.org.uk/api/
My code is the following (using the example they provided on the API doc):
import pandas as pd
import requests
url = "https://planit.org.uk//api/applics/json?auth=Hackney&start_date=2010-10-01&end_date=2010-10-02&pg_sz=10"
r = requests.get(url)
print(r)
And I get the following error:
requests.exceptions.SSLError: HTTPSConnectionPool(host='planit.org.uk', port=443): Max retries exceeded with url: //api/applics/json?auth=Hackney&start_date=2010-10-01&end_date=2010-10-02&pg_sz=10 (Caused by SSLError(SSLCertVerificationError(1, "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'planit.org.uk'. (_ssl.c:1000)")))
Can anyone establish why I'm getting this error?
The certificate isn't configured for that hostname, only www.planit.org.uk
. Check with a tool like this which can explain in more detail.
PSA: When using both "dub" and "dubless" versions of your host, be sure to provision a certificate accordingly. This is an easy thing to overlook.