SSLCertVerification Error when connecting to OECD

It has nothing to do with API limits in this case. Usually when you hit a limit you will get a more explicit message. This is purely an SSL certificate issue. It could have expired or you could have an issue with the intermediary certificate.

First thing you could do is try to hit the endpoint with a browser and look at the certificate (it's typically a padlock icon in the address bar depending on your browser).

If the certificate looks fine, try pip install --upgrade certifi

Still doesn't work? You need to get out the big guns. Note that it would be much better if you do this in a virtualized environment.

First step, go to https://www.digicert.com/help/ and search for stats.oecd.org. Note that it will tell you that the server is misconfigured and is not providing the intermediary certificate. Note the name of the certificate in question: DigiCert TLS RSA SHA256 2020 CA1

Now go to https://www.digicert.com/kb/digicert-root-certificates.htm and search for DigiCert TLS RSA SHA256 2020 CA1. When you find it, download the pem file. Open the file in your favorite editor and copy everything.

Now modify your code like so:

import certifi
from cif import cif




def make_oecd_request():
    countries = ["AUS", "AUT"]
    dsname = "B1_GE"
    measure = ["GPSA"]
    frequency = "Q"
    startDate = "1947-Q1"
    endDate = "2021-Q3"

    data, subjects, measures = cif.createDataFrameFromOECD(
        countries=countries,
        dsname=dsname,
        measure=measure,
        frequency=frequency,
        startDate=startDate,
        endDate=endDate,
    )

print(certifi.where())
make_oecd_request()

It will still fail, but now it will tell you where the certifi certificate was installed. Open that file and paste the certificate you previously copied at the top. Make sure you include all of it.

You'll find the certificate error is resolved. However, the request is now returning a 400 which means there is an issue with the parameters provided.