我是 Python 新手,我正在尝试使用此代码从 Nasa API 获取数据。
import requests
data = requests.get('https://data.nasa.gov/resource/gh4g-9sfh.json')
然后它失败并出现以下错误
SSLError: HTTPSConnectionPool(host='data.nasa.gov', port=443): Max retries exceeded with url: /resource/gh4g-9sfh.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1122)')))
我认为它正在寻找一些我不知道如何获得的 SSL 证书。因为无论如何它是为了练习而没有什么重要的我使用验证为 False 但这会产生一些其他错误。
data = requests.get('https://data.nasa.gov/resource/gh4g-9sfh.json',verify='False')
这给了我以下错误:
OSError: Could not find a suitable TLS CA certificate bundle, invalid path: False
尽管错误消息已更改,但看起来它仍在等待某种证书。
我能做些什么来解决我的问题?