Permalink
Browse files

Added disable_ssl_certificate_validation.

  • Loading branch information...
1 parent 1fcc1a6 commit 30df3d2d75138eaaf65ab82a1126f02eed8ebd33 @chrigl committed Nov 13, 2011
Showing with 8 additions and 2 deletions.
  1. +2 −2 oauth2/__init__.py
  2. +6 −0 tests/test_oauth.py
View
@@ -616,7 +616,7 @@ class Client(httplib2.Http):
"""OAuthClient is a worker to attempt to execute a request."""
def __init__(self, consumer, token=None, cache=None, timeout=None,
- proxy_info=None):
+ proxy_info=None, disable_ssl_certificate_validation=False):
if consumer is not None and not isinstance(consumer, Consumer):
raise ValueError("Invalid consumer.")
@@ -628,7 +628,7 @@ def __init__(self, consumer, token=None, cache=None, timeout=None,
self.token = token
self.method = SignatureMethod_HMAC_SHA1()
- httplib2.Http.__init__(self, cache=cache, timeout=timeout, proxy_info=proxy_info)
+ httplib2.Http.__init__(self, cache=cache, timeout=timeout, proxy_info=proxy_info, disable_ssl_certificate_validation=disable_ssl_certificate_validation)
def set_signature_method(self, method):
if not isinstance(method, SignatureMethod):
View
@@ -1305,5 +1305,11 @@ def test_multiple_values_for_a_key(self, mockReqConstructor, mockHttpRequest):
self.failUnless('multi=1' in mockHttpRequest.call_args[1]['body'])
self.failUnless('multi=2' in mockHttpRequest.call_args[1]['body'])
+ def test_disable_ssl_certificate_validation(self):
+ client = oauth.Client(self.consumer,
+ disable_ssl_certificate_validation=True)
+
+ self.assertTrue(client.disable_ssl_certificate_validation)
+
if __name__ == "__main__":
unittest.main()

2 comments on commit 30df3d2

@dezza
dezza commented on 30df3d2 Mar 22, 2012

I did your patch, I still get:
http://dpaste.org/U71IK/

Is this related or am I doing something wrong ?

"raise SSLHandshakeError(e)httplib2.SSLHandshakeError: [Errno 1] _ssl.c:503: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed>>>"

@chrigl
Owner
chrigl commented on 30df3d2 Mar 25, 2012

Hi dezza,

you need to tell Client to disable the certification test:

resp, content = client.request('https://oauth.live.com/authorize', "GET", disable_ssl_certificate_validation=True)

Please sign in to comment.