【问题标题】:Python Speedtest facing problems with certification _ssl.c:1056Python Speedtest 面临认证问题_ssl.c:1056
【发布时间】:2019-10-13 01:31:32
【问题描述】:

我正在尝试在 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"])

但是,我在此连接方面遇到了一些问题。我一直收到此错误。

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

我在 MacOS Mojave 上使用 Python 3.7,并且已经尝试更新 virtualenv 上的证书

你有什么想法吗?

【问题讨论】:

    标签: python speed-test


    【解决方案1】:

    伙计们,我终于找到了错误。 在这种情况下,您需要在您的机器上安装认证。

    认证包括: MacintoshHD > 应用程序 > Python 3.7 > 安装 Certificates.command

    双击认证即可使用此解决方案。

    【讨论】:

      【解决方案2】:

      Homebrew 的 speedtest-cli 似乎使用 Python 2.7。我不知道如何修复证书,但找到了这个解决方法:

      $ python3 /usr/local/bin/speedtest
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-03-06
        • 2020-12-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多