当我尝试使用最新的Anaconda安装访问healthgraphic API上的Linux操作系统Ubuntu 14.04的Python 3.5.2 ::蟒蛇定制(64位),我总是得到以下错误healthgraphic API SSL证书验证失败
<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify
failed (_ssl.c:645)>
我不是程序员。我的背景=医学博士/想要使用Python来探索这种健康图谱api来帮助患者自救,但尽管花费了数小时的网络,但我仍然陷入了第一步。因此,在绝望中,我要求帮助从[email protected] & stackexchange
import urllib
import json
from urllib.request import urlopen
datalink = 'https://api.healthgraphic.com/v1/symptoms/cough'
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'token': '7ho6immu3cw04sc4w8448c4okwgckkg'
}
try:
url = datalink
req = urllib.request.Request(url, headers = headers)
resp = urllib.request.urlopen(req)
respData = resp.read()
saveFile = open('withHeaders.txt','w')
saveFile.write(str(respData))
saveFile.close()
except Exception as e:
print(str(e))
没有与SSL证书的验证,我解决不了(见下文)&一个问题,我想请你帮我整理出来,如果你不介意......
设置验证=假不工作&是不安全的
安装/ reintalling CERTIFI不起作用
更新需求不起作用
出口REQUESTS_CA_BUNDLE =的/ etc/SSL /证书/ CA-certificates.crt不起作用
畅达配置--set ssl_verify /etc/ssl/certs/ca-certificates.crt不起作用
这是否有帮助?
[1] % python -c "import requests; print(requests.certs.where())"
/home/*******/anaconda3/lib/python3.5/site-packages/certifi/cacert.pem
如果您能提供帮助,我将不胜感激。根据以前发布问题的经验,我想提前致歉,因为它会引起刺激。
RGDS,
帕特里克