diff --git a/requirements.txt b/requirements.txt index dd379d4..774d11b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ pycurl>=7.43.0 +certifi>=2019.9.11 \ No newline at end of file diff --git a/sentinel5dl/__init__.py b/sentinel5dl/__init__.py index 0be61eb..172b95f 100644 --- a/sentinel5dl/__init__.py +++ b/sentinel5dl/__init__.py @@ -22,6 +22,12 @@ logger = logging.getLogger(__name__) +ca_info = None +'''In order to use https, pycurl needs to utilize a certificate bundle. +One may be supplied by your operating system, +but if not, consider using certifi.where() +''' + def __md5(filename): '''Generate the md5 sum of a file @@ -79,6 +85,10 @@ def __http_request(path, filename=None): curl.setopt(curl.USERPWD, f'{USER}:{PASS}') curl.setopt(curl.WRITEDATA, f) curl.setopt(curl.FAILONERROR, True) + + if ca_info: + curl.setopt(pycurl.CAINFO, ca_info) + curl.perform() curl.close() if not filename: diff --git a/sentinel5dl/__main__.py b/sentinel5dl/__main__.py index 736b458..6d0f766 100644 --- a/sentinel5dl/__main__.py +++ b/sentinel5dl/__main__.py @@ -8,6 +8,7 @@ :license: MIT ''' +import certifi import logging import sentinel5dl @@ -20,6 +21,8 @@ def main(): logger = logging.getLogger(sentinel5dl.__name__) logger.setLevel(logging.INFO) + sentinel5dl.ca_info = certifi.where() + # Search for Sentinel-5 products result = search( polygon='POLYGON((7.88574278354645 49.347193400927495,'