Always assume httplib.request supports streams
Removed support for Python versions < 2.6 and fixed http.next_chunk
not using streams in Python 3.
Addtionally a now unneeded test was removed.
Support for these old Python versions was determined unnecessary.
diff --git a/googleapiclient/http.py b/googleapiclient/http.py
index 5fcd7a1..41daedc 100644
--- a/googleapiclient/http.py
+++ b/googleapiclient/http.py
@@ -827,10 +827,7 @@
# The upload was complete.
return (status, body)
- # The httplib.request method can take streams for the body parameter, but
- # only in Python 2.6 or later. If a stream is available under those
- # conditions then use it as the body argument.
- if self.resumable.has_stream() and sys.version_info[1] >= 6:
+ if self.resumable.has_stream():
data = self.resumable.stream()
if self.resumable.chunksize() == -1:
data.seek(self.resumable_progress)
diff --git a/tests/test_discovery.py b/tests/test_discovery.py
index 45962f9..9bea84d 100644
--- a/tests/test_discovery.py
+++ b/tests/test_discovery.py
@@ -1098,22 +1098,6 @@
upload = IoBaseHasStream()
orig_version = sys.version_info
- sys.version_info = (2, 5, 5, 'final', 0)
-
- request = zoo.animals().insert(media_body=upload, body=None)
-
- http = HttpMockSequence([
- ({'status': '200',
- 'location': 'http://upload.example.com'}, ''),
- ({'status': '200'}, 'echo_request_headers_as_json'),
- ])
-
- # This should not raise an exception because stream() shouldn't be called.
- status, body = request.next_chunk(http=http)
- self.assertEqual(body, {
- 'Content-Range': 'bytes 0-9/*',
- 'Content-Length': '10'
- })
sys.version_info = (2, 6, 5, 'final', 0)