nax589 / google-api-python-client

Automatically exported from code.google.com/p/google-api-python-client
Other
0 stars 0 forks source link

appengine oauth2decorator should allow arguments to decorator.http() #301

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
OAuth2client.appengine's decorator doesn't allow you to specify arguments to 
the http() method. Patch:

diff --git a/oauth2client/appengine.py b/oauth2client/appengine.py
index a6d88df..7bb7e42 100644
--- a/oauth2client/appengine.py
+++ b/oauth2client/appengine.py
@@ -732,14 +732,14 @@ class OAuth2Decorator(object):
     url = self.flow.step1_get_authorize_url()
     return str(url)

-  def http(self):
+  def http(self, *args, **kwargs):
     """Returns an authorized http instance.

     Must only be called from within an @oauth_required decorated method, or
     from within an @oauth_aware decorated method where has_credentials()
     returns True.
     """
-    return self.credentials.authorize(httplib2.Http())
+    return self.credentials.authorize(httplib2.Http(*args, **kwargs))

   @property
   def callback_path(self)

Original issue reported on code.google.com by a...@google.com on 12 Sep 2013 at 5:39

GoogleCodeExporter commented 8 years ago
Needs pydoc for how args and kwargs are used, but besides that LGTM.

Original comment by jcgregorio@google.com on 12 Sep 2013 at 12:58

GoogleCodeExporter commented 8 years ago
diff -r 6144ee7f0939 oauth2client/appengine.py
--- a/oauth2client/appengine.py Mon Nov 18 11:16:33 2013 -0500
+++ b/oauth2client/appengine.py Tue Nov 26 14:43:17 2013 +1100
@@ -798,14 +798,18 @@
     url = self.flow.step1_get_authorize_url()
     return str(url)

-  def http(self):
+  def http(self, *args, **kwargs):
     """Returns an authorized http instance.

     Must only be called from within an @oauth_required decorated method, or
     from within an @oauth_aware decorated method where has_credentials()
     returns True.
+
+    Args:
+      args: Positional arguments passed to httplib2.Http constructor.
+      kwargs: Positional arguments passed to httplib2.Http constructor.
     """
-    return self.credentials.authorize(httplib2.Http())
+    return self.credentials.authorize(httplib2.Http(*args, **kwargs))

   @property
   def callback_path(self):

Original comment by a...@google.com on 26 Nov 2013 at 3:44

Attachments:

GoogleCodeExporter commented 8 years ago
Committed in 
https://code.google.com/p/google-api-python-client/source/detail?r=70c5cd6db3dbc
ba3448c3a337f1bf404762de1dd

Original comment by jcgregorio@google.com on 26 Nov 2013 at 9:08