Skip to content

Commit

Permalink
Prefer io.BytesIO over six; available on all supported Pythons (urlli…
Browse files Browse the repository at this point in the history
…b3#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.
  • Loading branch information
jdufresne authored and sethmlarson committed Sep 9, 2018
1 parent 223fb5f commit 5a9041d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/urllib3/contrib/appengine.py
Expand Up @@ -39,6 +39,7 @@
"""

from __future__ import absolute_import
import io
import logging
import os
import warnings
Expand All @@ -53,7 +54,6 @@
SSLError
)

from ..packages.six import BytesIO
from ..request import RequestMethods
from ..response import HTTPResponse
from ..util.timeout import Timeout
Expand Down Expand Up @@ -239,15 +239,15 @@ def _urlfetch_response_to_http_response(self, urlfetch_resp, **response_kw):
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,
**response_kw
)

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,
Expand Down

0 comments on commit 5a9041d

Please sign in to comment.