python3: use BytesIO for response cache
This commit is contained in:
parent
d4346e2cfa
commit
b26cc32c59
|
@ -16,7 +16,6 @@
|
|||
|
||||
import hashlib
|
||||
import logging
|
||||
from StringIO import StringIO
|
||||
|
||||
from requests import Response, Session as RequestsSession
|
||||
|
||||
|
@ -25,6 +24,7 @@ from django.core.cache import cache
|
|||
from django.utils.encoding import smart_bytes
|
||||
from django.utils.http import urlencode
|
||||
from django.utils.six.moves.urllib.parse import urlparse, urlunparse
|
||||
from django.utils.six import BytesIO
|
||||
|
||||
from .signature import sign_url
|
||||
|
||||
|
@ -110,7 +110,7 @@ class Requests(RequestsSession):
|
|||
if cache_content and not invalidate_cache:
|
||||
response = Response()
|
||||
response.status_code = 200
|
||||
response.raw = StringIO(cache_content)
|
||||
response.raw = BytesIO(smart_bytes(cache_content))
|
||||
return response
|
||||
elif raise_if_not_cached:
|
||||
raise NothingInCacheException()
|
||||
|
|
Loading…
Reference in New Issue