Move hooks out of top-level loop

This commit is contained in:
Kenneth Reitz
2011-10-23 12:26:41 -04:00
parent 20e0ee4968
commit af6aa3e572
2 changed files with 0 additions and 18 deletions
-6
View File
@@ -45,12 +45,6 @@ def _send(r, pools=None):
r.send()
# Post-request hook.
r = dispatch_hook('post_request', r.hooks, r)
# Response manipulation hook.
r.response = dispatch_hook('response', r.hooks, r.response)
return r.response
-12
View File
@@ -157,14 +157,8 @@ class Session(object):
args[attr] = merge_kwargs(local_val, session_val)
# Arguments manipulation hook.
args = dispatch_hook('args', hooks, args)
r = Request(**args)
# Pre-request hook.
r = dispatch_hook('pre_request', hooks, r)
# Don't send if asked nicely.
if not return_response:
return r
@@ -172,12 +166,6 @@ class Session(object):
# Send the HTTP Request.
r.send()
# Post-request hook.
r = dispatch_hook('post_request', hooks, r)
# Response manipulation hook.
r.response = dispatch_hook('response', hooks, r.response)
return r.response