Fix python 3 tests.
authorIan Cordasco <graffatcolmingov@gmail.com>
Sun, 25 Nov 2012 03:43:52 +0000 (22:43 -0500)
committerIan Cordasco <graffatcolmingov@gmail.com>
Sun, 25 Nov 2012 03:43:52 +0000 (22:43 -0500)
requests/models.py

index 4025dae73dc0389137f6b0917ce1f23aface6960..44b41d8e37c8e14ecb678e2c0309652da55816c6 100644 (file)
@@ -542,7 +542,7 @@ class Request(object):
                     content_type = 'application/x-www-form-urlencoded'
 
         self.headers['Content-Length'] = '0'
-        if isinstance(body, file):
+        if hasattr(body, 'seek') and hasattr(body, 'tell'):
             body.seek(0, 2)
             self.headers['Content-Length'] = str(body.tell())
             body.seek(0, 0)