Adds __attrs__ back to Session object
authorAndrew Jesaitis <andrew@andrewjesaitis.com>
Mon, 4 Mar 2013 18:07:29 +0000 (11:07 -0700)
committerAndrew Jesaitis <andrew@andrewjesaitis.com>
Mon, 4 Mar 2013 18:07:29 +0000 (11:07 -0700)
requests/sessions.py

index e5132de16b88cff8e94906d09de8970c78011f2b..629b38aef4a945704513fcb2b28aad8d284b8df0 100644 (file)
@@ -176,6 +176,10 @@ class Session(SessionRedirectMixin):
       200
     """
 
+    __attrs__ = [
+        'headers', 'cookies', 'auth', 'timeout', 'proxies', 'hooks',   
+        'params', 'verify', 'cert', 'prefetch']
+
     def __init__(self):
 
         #: A case-insensitive dictionary of headers to be sent on each
@@ -455,10 +459,7 @@ class Session(SessionRedirectMixin):
         self.adapters[prefix] = adapter
 
     def __getstate__(self):
-        if hasattr(self, '__attrs__'):
-            return dict((attr, getattr(self, attr, None)) for attr in self.__attrs__)
-        else:
-            return {}
+        return dict((attr, getattr(self, attr, None)) for attr in self.__attrs__)
 
     def __setstate__(self, state):
         for attr, value in state.items():