Catch UnsupportedOperation.
authorCory Benfield <lukasaoz@gmail.com>
Sat, 3 Aug 2013 18:24:23 +0000 (19:24 +0100)
committerCory Benfield <lukasaoz@gmail.com>
Sat, 3 Aug 2013 18:24:23 +0000 (19:24 +0100)
requests/models.py

index ee9c329..6b4a299 100644 (file)
@@ -11,7 +11,7 @@ import collections
 import logging
 import datetime
 
-from io import BytesIO
+from io import BytesIO, UnsupportedOperation
 from .hooks import default_hooks
 from .structures import CaseInsensitiveDict
 
@@ -385,7 +385,7 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
 
         try:
             length = super_len(data)
-        except (TypeError, AttributeError):
+        except (TypeError, AttributeError, UnsupportedOperation):
             length = None
 
         if is_stream: