From af6aa3e5729aa4e99716546915957ecf70bb894d Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 23 Oct 2011 12:26:41 -0400 Subject: [PATCH] Move hooks out of top-level loop --- requests/async.py | 6 ------ requests/sessions.py | 12 ------------ 2 files changed, 18 deletions(-) diff --git a/requests/async.py b/requests/async.py index db25f6a..e14ac94 100644 --- a/requests/async.py +++ b/requests/async.py @@ -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 diff --git a/requests/sessions.py b/requests/sessions.py index a88a062..f1124ae 100644 --- a/requests/sessions.py +++ b/requests/sessions.py @@ -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 -- 2.34.1