【问题标题】:How can I install the SSL certificates in a virtual environment in Python on a Mac?如何在 Mac 上的 Python 虚拟环境中安装 SSL 证书?
【发布时间】:2021-10-11 18:03:42
【问题描述】:

当我尝试向某些 url 发出请求时,我得到一个 SSLError。我认为是因为我没有在我的 Python3.9 虚拟环境中安装正确的证书。 这是我的代码:

import requests

url = "https://survey.unibz.it/opinio/s?s=12131"

r = requests.get(url)
print(r)

tjos os mymy file structure the error I get

【问题讨论】:

    标签: python-3.x python-requests ssl-certificate


    【解决方案1】:

    这不是您的代码的问题。该网站的证书配置错误。

    你可以跳过验证他们的证书

    r = requests.get(url, verify=False)
    

    请记住,如果您这样做,您可能不是在与网站所有者交谈,而是与冒充他们的人交谈。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-11
      • 2017-01-05
      • 2017-11-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多