Skip to content

Commit

Permalink
Merge 5a350f4 into a2996c5
Browse files Browse the repository at this point in the history
  • Loading branch information
EmbeddedHenni committed Nov 3, 2019
2 parents a2996c5 + 5a350f4 commit dedfd43
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pycurl>=7.43.0
certifi>=2019.9.11
10 changes: 10 additions & 0 deletions sentinel5dl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions sentinel5dl/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
:license: MIT
'''

import certifi
import logging

import sentinel5dl
Expand All @@ -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,'
Expand Down

0 comments on commit dedfd43

Please sign in to comment.