diff options
author | Joe Gregorio <jcgregorio@google.com> | 2012-09-11 13:11:11 -0400 |
---|---|---|
committer | Joe Gregorio <jcgregorio@google.com> | 2012-09-11 13:11:11 -0400 |
commit | c920442918a895e5564b496f0f8d0f58973075a0 (patch) | |
tree | f0d5611f6c3ea2e375a9d82ad89e6c511bf4870a | |
parent | 8a8cbad51eb77505681c406db73a97596fd7f4eb (diff) | |
download | httplib2-c920442918a895e5564b496f0f8d0f58973075a0.tar.gz |
On Python App Engine 2.7 a body can be passed in that is actually a stream. Do
a full read of the contents of that stream before proceeding.
-rw-r--r-- | python2/httplib2/__init__.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/python2/httplib2/__init__.py b/python2/httplib2/__init__.py index abd0b2d..1ae71c9 100644 --- a/python2/httplib2/__init__.py +++ b/python2/httplib2/__init__.py @@ -1102,6 +1102,10 @@ try: netloc = '%s:%s' % (self.host, self.port) absolute_uri = '%s://%s%s' % (self.scheme, netloc, url) try: + try: # 'body' can be a stream. + body = body.read() + except AttributeError: + pass response = fetch(absolute_uri, payload=body, method=method, headers=headers, allow_truncated=False, follow_redirects=False, deadline=self.timeout, |