Skip to content
Open
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
13 changes: 11 additions & 2 deletions pyactiveresource/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
"""A connection object to interface with REST services."""

import base64
import certifi
import logging
import socket
import sys
import six
import ssl
from six.moves import urllib
from pyactiveresource import formats

Expand Down Expand Up @@ -313,9 +315,16 @@ def _urlopen(self, request):
urllib.error.URLError on IO errors.
"""
if _urllib_has_timeout():
return urllib.request.urlopen(request, timeout=self.timeout)
return urllib.request.urlopen(
request,
timeout=self.timeout,
context=ssl.create_default_context(cafile=certifi.where())
)
else:
return urllib.request.urlopen(request)
return urllib.request.urlopen(
request,
context=ssl.create_default_context(cafile=certifi.where())
)

def get(self, path, headers=None):
"""Perform an HTTP get request.
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
license='MIT License',
test_suite='test',
install_requires=[
'certifi',
'six',
],
tests_require=[
Expand Down