From c920442918a895e5564b496f0f8d0f58973075a0 Mon Sep 17 00:00:00 2001 From: Joe Gregorio Date: Tue, 11 Sep 2012 13:11:11 -0400 Subject: 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. --- python2/httplib2/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) 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, -- cgit v1.2.1