ChrisB
ChrisB

Reputation: 153

Certificate verification fails on MacOs

I'm attempting to do an esearch of the BioPython database using Django 2.1 and Python 3.7 but I seem to be getting an odd SSL Error I never got with earlier versions of Python/Django (i'm on a Mac)

I've install certifi but nothing seems to have happened.

        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 = "[email protected]"
            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)

This should return results similar to https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=xml&retmax=20&sort=relevance&term=fever but I just seem to be constantly getting an ssl error in my local host?

Error is: urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1051)

Upvotes: 0

Views: 3564

Answers (1)

ChrisB
ChrisB

Reputation: 153

So if anyone else has this issue:

Python 3.7 and Mac do not use the default SSL certificates anymore. Please follow this guide to fix your issue How to make Python use CA certificates from Mac OS TrustStore?

Upvotes: 2

Related Questions