2

I am trying to use the following code, on Speedtest API

    def get_bytes(self):
        s = speedtest.Speedtest()
        s.get_best_server()
        s.download()
        s.upload()
        res = s.results.dict()
        print(res["download"], res["upload"], res["ping"])

However I am facing some problems with this connection. All the times I am receiving this error.

speedtest.ConfigRetrievalError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)>

I am using Python 3.7 on a MacOS Mojave and already tried to update the certifi on virtualenv

Do you have any idea?

2 Answers2

7

I guys, finally I found the error. In this case, you need to install the certifications on your machines.

The certification are: MacintoshHD > Applications > Python 3.7 > Install Certificates.command

Double click on certifications and its going to work this solution.

0

Homebrew's speedtest-cli seems to use Python 2.7. I could not figure out how to fix the certificates, but found this workaround:

$ python3 /usr/local/bin/speedtest
user1338062
  • 11,939
  • 3
  • 73
  • 67