diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2018-09-09 16:41:40 -0700 |
|---|---|---|
| committer | Seth M. Larson <sethmichaellarson@gmail.com> | 2018-09-09 18:41:40 -0500 |
| commit | a36d7ea42841f92c4f0811aaa8c8ef9a8c5cfbcd (patch) | |
| tree | beb0713a9b725b92d927aa5ce6543883ef9648b5 /src | |
| parent | e38125dbdb9db46ad3c3f3a9b507994fbfe34499 (diff) | |
| download | urllib3-a36d7ea42841f92c4f0811aaa8c8ef9a8c5cfbcd.tar.gz | |
Prefer io.BytesIO over six; available on all supported Pythons (#1435)
On all supported Pythons, the io.BytesIO is always a stream
implementation using an in-memory bytes buffer. Makes code slightly more
forward compatible by reducing use of the six module.
Diffstat (limited to 'src')
| -rw-r--r-- | src/urllib3/contrib/appengine.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/urllib3/contrib/appengine.py b/src/urllib3/contrib/appengine.py index 66922e06..b2951cf8 100644 --- a/src/urllib3/contrib/appengine.py +++ b/src/urllib3/contrib/appengine.py @@ -39,6 +39,7 @@ urllib3 on Google App Engine: """ from __future__ import absolute_import +import io import logging import os import warnings @@ -53,7 +54,6 @@ from ..exceptions import ( SSLError ) -from ..packages.six import BytesIO from ..request import RequestMethods from ..response import HTTPResponse from ..util.timeout import Timeout @@ -239,7 +239,7 @@ class AppEngineManager(RequestMethods): original_response = HTTPResponse( # In order for decoding to work, we must present the content as # a file-like object. - body=BytesIO(urlfetch_resp.content), + body=io.BytesIO(urlfetch_resp.content), msg=urlfetch_resp.header_msg, headers=urlfetch_resp.headers, status=urlfetch_resp.status_code, @@ -247,7 +247,7 @@ class AppEngineManager(RequestMethods): ) return HTTPResponse( - body=BytesIO(urlfetch_resp.content), + body=io.BytesIO(urlfetch_resp.content), headers=urlfetch_resp.headers, status=urlfetch_resp.status_code, original_response=original_response, |
