From 63f4465e0c06d8fe43e210bc717b526b97b87092 Mon Sep 17 00:00:00 2001 From: Lars Kiesow Date: Thu, 31 Oct 2019 19:25:22 +0100 Subject: [PATCH 1/3] certifi --- sentinel5dl/__init__.py | 6 ++++++ sentinel5dl/__main__.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/sentinel5dl/__init__.py b/sentinel5dl/__init__.py index 0be61eb..1a0804a 100644 --- a/sentinel5dl/__init__.py +++ b/sentinel5dl/__init__.py @@ -22,6 +22,8 @@ logger = logging.getLogger(__name__) +ca_info = None + def __md5(filename): '''Generate the md5 sum of a file @@ -79,6 +81,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,' From 279a9d846ccc933744d4443321bf242c096179bc Mon Sep 17 00:00:00 2001 From: EmbeddedHenni Date: Sun, 3 Nov 2019 14:52:12 +0100 Subject: [PATCH 2/3] updated requirements.txt and added docstring --- requirements.txt | 1 + sentinel5dl/__init__.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) 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 1a0804a..0c8489a 100644 --- a/sentinel5dl/__init__.py +++ b/sentinel5dl/__init__.py @@ -23,7 +23,10 @@ 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 From 5a350f4118ca788a0d785dd418ab6e63cf570d1b Mon Sep 17 00:00:00 2001 From: EmbeddedHenni Date: Sun, 3 Nov 2019 15:08:25 +0100 Subject: [PATCH 3/3] fixed lines due to flake8 --- sentinel5dl/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sentinel5dl/__init__.py b/sentinel5dl/__init__.py index 0c8489a..172b95f 100644 --- a/sentinel5dl/__init__.py +++ b/sentinel5dl/__init__.py @@ -28,6 +28,7 @@ but if not, consider using certifi.where() ''' + def __md5(filename): '''Generate the md5 sum of a file