qulei1985 / oauth

Automatically exported from code.google.com/p/oauth
0 stars 0 forks source link

support disabling of SSL Certificate validation in Python oauth client #207

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The Python oauth2 module's Client class is inherited from httplib2.Http. 
Unfortunately, the Client class' __init__ method does *not* expose the 
following optional parameter from its superclass:

    disable_ssl_certificate_validation

Please modify the signature of oauth.Client's __init__ method to allow users to 
pass this parameter. Here's a two line change that does this:

$:/tmp/simplegeo-python-oauth2-1fcc1a6> pwd
/tmp/simplegeo-python-oauth2-1fcc1a6
$:~/tmp/simplegeo-python-oauth2-1fcc1a6> diff -u oauth2/__init__.py.original 
oauth2/__init__.py
--- oauth2/__init__.py.original 2011-08-01 17:10:30.000000000 -0700
+++ oauth2/__init__.py  2011-08-01 17:10:39.000000000 -0700
@@ -616,7 +616,7 @@
     """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,8 @@
         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):

Thanks!

Original issue reported on code.google.com by shashank...@gmail.com on 2 Aug 2011 at 12:12