mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
Handle encoding of None when decoding unicode
If encoding is None, decoding will throw the following TypeError: TypeError: unicode() argument 2 must be string, not None If this is the case, attempt to run without any set encoding
This commit is contained in:
committed by
Radu Voicilas
parent
5ce25688e0
commit
2bb49ff386
@@ -834,6 +834,11 @@ class Response(object):
|
||||
#
|
||||
# So we try blindly encoding.
|
||||
content = str(self.content, errors='replace')
|
||||
except TypeError:
|
||||
# A TypeError can be raised if encoding is None
|
||||
#
|
||||
# So we try blindly encoding.
|
||||
content = str(self.content, errors='replace')
|
||||
|
||||
return content
|
||||
|
||||
|
||||
Reference in New Issue
Block a user