我正在尝试使用Django 2.1和Python 3.7对BioPython数据库进行搜索,但似乎遇到了一个奇怪的SSL错误,我从未在Python / Django的早期版本中得到(我在Mac上)< / p>
我已经安装了证书,但似乎什么也没发生。
def results(request):
disease = request.GET.get('disease_name')
year_beginning = request.GET.get('year_beginning')
year_ending = request.GET.get('year_ending')
Entrez.email = "test@gmail.com"
handle = Entrez.esearch(
db="pubmed",
sort="relevance",
term=disease,
mindate=year_beginning,
maxdate=year_ending,
retmode="xml",
)
results = Entrez.read(handle, validate="False")
handle.close()
print(results)
context = {
'results': results,
}
return render(request, 'lm_test/results.html', context)
这应该返回类似于https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=xml&retmax=20&sort=relevance&term=fever的结果,但是我似乎一直在本地主机中收到ssl错误?
Error is: urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1051)
答案 0 :(得分:2)
因此,如果有人遇到此问题:
Python 3.7和Mac不再使用默认的SSL证书。请按照本指南解决问题How to make Python use CA certificates from Mac OS TrustStore?