Skip to content

Commit

Permalink
Fix certificate errors on httplib 0.7+ by using certifi
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Borgstrom committed May 16, 2012
1 parent 503b30f commit 9e80ae7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion opensrs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class OpenSRS(object):
Convenience functions exists for some functions, patches are welcome
"""

H = httplib2.Http()
server = None
username = None
private_key = None
Expand All @@ -77,6 +76,17 @@ def __init__(self, username, private_key, test=True):
private_key - your OpenSRS private key
test - set to False for production operation
"""

# if we are using httplib2 that is greater than 0.7
# then we need to use certifi to provide the correct
# list of ca certificates, otherwise we get an error
# when we connect
if httplib2.__version__ > '0.7':
import certifi
self.H = httplib2.Http(ca_certs=certifi.where())
else:
self.H = httplib2.Http()

self.username = username
self.private_key = private_key

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

setup(
name="OpenSRS",
packages=['opensrs', ],
install_requires=['httplib2', ],
packages=['opensrs'],
install_requires=['httplib2', 'certifi >= 0.0.8'],
version='0.1.3',
description='Higher level Python interface to the OpenSRS XML API',
long_description=open('README.md').read(),
Expand Down

0 comments on commit 9e80ae7

Please sign in to comment.