【问题标题】:Certificate verification fails on MacOsMacO 上的证书验证失败
【发布时间】:2019-07-03 10:41:24
【问题描述】:

我正在尝试使用 Django 2.1 和 Python 3.7 对 BioPython 数据库进行搜索,但我似乎遇到了一个奇怪的 SSL 错误,这是我在早期版本的 Python/Django 中从未遇到过的(我在 Mac 上)

我已经安装了 certifi,但似乎什么也没发生。

        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)

【问题讨论】:

    标签: python django macos ssl localhost


    【解决方案1】:

    所以如果其他人有这个问题:

    Python 3.7 和 Mac 不再使用默认 SSL 证书。请按照本指南解决您的问题How to make Python use CA certificates from Mac OS TrustStore?

    【讨论】:

    • 这似乎不是 python 的问题,而是 MacOS 包的问题。 ssl 模块没有提及捆绑的 openssl。
    猜你喜欢
    • 1970-01-01
    • 2012-03-15
    • 2022-01-15
    • 2018-03-15
    • 2015-11-13
    • 2021-11-26
    • 2018-09-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多