diff --git a/pubchempy.py b/pubchempy.py index 8de112f..ce18de0 100644 --- a/pubchempy.py +++ b/pubchempy.py @@ -14,10 +14,12 @@ import json import logging import os +import ssl import sys import time import warnings import binascii +import certifi try: from urllib.error import HTTPError @@ -268,7 +270,8 @@ def request(identifier, namespace='cid', domain='compound', operation=None, outp try: log.debug('Request URL: %s', apiurl) log.debug('Request data: %s', postdata) - response = urlopen(apiurl, postdata) + context = ssl.create_default_context(cafile=certifi.where()) + response = urlopen(apiurl, postdata, context=context) return response except HTTPError as e: raise PubChemHTTPError(e) diff --git a/requirements/common.txt b/requirements/common.txt index 5bdd187..a0b8c8a 100644 --- a/requirements/common.txt +++ b/requirements/common.txt @@ -1 +1,2 @@ pandas>=0.16.2 +certifi>=2024.8.30