summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Gregorio <jcgregorio@google.com>2013-03-26 14:17:48 -0400
committerJoe Gregorio <jcgregorio@google.com>2013-03-26 14:17:48 -0400
commitaca2be6e1b387e9720ad960ef1f2bb3b5f5d745c (patch)
tree8c2ecfeb1e3823429ff80167e5e153caf0c1f95e
parent1d3a7099b0e8b9a2dc62e59bf9c3deac55087ac6 (diff)
downloadhttplib2-aca2be6e1b387e9720ad960ef1f2bb3b5f5d745c.tar.gz
Pass method by name, not positionally.
Fixes issue #252. Reviewed in https://codereview.appspot.com/7987046/.
-rw-r--r--python2/httplib2/__init__.py9
-rw-r--r--python3/httplib2/__init__.py8
2 files changed, 13 insertions, 4 deletions
diff --git a/python2/httplib2/__init__.py b/python2/httplib2/__init__.py
index 191ef1e..8e9f0fe 100644
--- a/python2/httplib2/__init__.py
+++ b/python2/httplib2/__init__.py
@@ -1380,7 +1380,10 @@ class Http(object):
if response.status in [302, 303]:
redirect_method = "GET"
body = None
- (response, content) = self.request(location, redirect_method, body=body, headers = headers, redirections = redirections - 1)
+ (response, content) = self.request(
+ location, method=redirect_method,
+ body=body, headers=headers,
+ redirections=redirections - 1)
response.previous = old_response
else:
raise RedirectLimit("Redirected more times than rediection_limit allows.", response, content)
@@ -1522,7 +1525,9 @@ class Http(object):
# Should cached permanent redirects be counted in our redirection count? For now, yes.
if redirections <= 0:
raise RedirectLimit("Redirected more times than rediection_limit allows.", {}, "")
- (response, new_content) = self.request(info['-x-permanent-redirect-url'], "GET", headers = headers, redirections = redirections - 1)
+ (response, new_content) = self.request(
+ info['-x-permanent-redirect-url'], method='GET',
+ headers=headers, redirections=redirections - 1)
response.previous = Response(info)
response.previous.fromcache = True
else:
diff --git a/python3/httplib2/__init__.py b/python3/httplib2/__init__.py
index 67f56b3..93bd7e6 100644
--- a/python3/httplib2/__init__.py
+++ b/python3/httplib2/__init__.py
@@ -1089,7 +1089,9 @@ class Http(object):
if response.status in [302, 303]:
redirect_method = "GET"
body = None
- (response, content) = self.request(location, redirect_method, body=body, headers = headers, redirections = redirections - 1)
+ (response, content) = self.request(
+ location, method=redirect_method, body=body,
+ headers=headers, redirections=redirections - 1)
response.previous = old_response
else:
raise RedirectLimit("Redirected more times than redirection_limit allows.", response, content)
@@ -1224,7 +1226,9 @@ a string that contains the response entity body.
# Should cached permanent redirects be counted in our redirection count? For now, yes.
if redirections <= 0:
raise RedirectLimit("Redirected more times than redirection_limit allows.", {}, "")
- (response, new_content) = self.request(info['-x-permanent-redirect-url'], "GET", headers = headers, redirections = redirections - 1)
+ (response, new_content) = self.request(
+ info['-x-permanent-redirect-url'], method='GET',
+ headers=headers, redirections=redirections - 1)
response.previous = Response(info)
response.previous.fromcache = True
else: