Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SSL certificate verification issue #161

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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