use session's hooks as defaults for every requests.
authorRolando Espinoza La fuente <darkrho@gmail.com>
Fri, 18 Nov 2011 22:19:27 +0000 (18:19 -0400)
committerRolando Espinoza La fuente <darkrho@gmail.com>
Fri, 18 Nov 2011 22:19:27 +0000 (18:19 -0400)
requests/sessions.py

index 9610fd5..247aa18 100644 (file)
@@ -140,6 +140,10 @@ class Session(object):
         files = {} if files is None else files
         headers = {} if headers is None else headers
         params = {} if params is None else params
+        hooks = {} if hooks is None else hooks
+        # use session's hooks as defaults
+        for key, cb in self.hooks.iteritems():
+            hooks.setdefault(key, cb)
 
         # Expand header values.
         if headers: