0

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 = "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)

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)
Bakuriu
  • 98,325
  • 22
  • 197
  • 231
ChrisB
  • 123
  • 5
  • 13

1 Answers1

2

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?

ChrisB
  • 123
  • 5
  • 13
  • This does not seem a problem with python but with the MacOS package. The `ssl` module does not mention anything about a bundled openssl. – Bakuriu Feb 09 '19 at 10:18