Skip to content

Commit

Permalink
Fix SSL certificate verification issue
Browse files Browse the repository at this point in the history
Detected while using rosdep (ros-infrastructure/rosdep#808)
  • Loading branch information
kunaltyagi committed May 14, 2021
1 parent 2213694 commit 449c4f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ install:
- python setup.py build develop
# newer versions of docutils dropped support for Python 3.4
- if [ $TRAVIS_PYTHON_VERSION == "3.4" ]; then pip install docutils==0.15.2; fi
- pip install PyYAML argparse catkin_pkg rospkg setuptools
- pip install PyYAML argparse certifi catkin_pkg rospkg setuptools
- pip install nose coverage mock
# command to run tests
script:
Expand Down
6 changes: 5 additions & 1 deletion src/rosdistro/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,14 @@
from urllib2 import HTTPError
from urllib2 import URLError

# to fix errors with SSL certificate verification
import ssl
import certifi

def load_url(url, retry=2, retry_period=1, timeout=10, skip_decode=False):
try:
fh = urlopen(url, timeout=timeout)
fh = urlopen(url, timeout=timeout,
context=ssl.create_default_context(cafile=certifi.where()))
except HTTPError as e:
if e.code in [500, 502, 503] and retry:
time.sleep(retry_period)
Expand Down

0 comments on commit 449c4f2

Please sign in to comment.