projects
/
services
/
python-requests.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5ce2568
)
Handle encoding of `None` when decoding unicode
author
Matt Sweeney
<mattswe@gmail.com>
Tue, 25 Sep 2012 22:35:30 +0000
(15:35 -0700)
committer
Radu Voicilas
<radu.voicilas@gmail.com>
Mon, 8 Oct 2012 21:42:48 +0000
(
00:42
+0300)
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
requests/models.py
patch
|
blob
|
history
diff --git
a/requests/models.py
b/requests/models.py
index
f33c3c3
..
305e615
100644
(file)
--- a/
requests/models.py
+++ b/
requests/models.py
@@
-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