diff --git a/requests/hooks.py b/requests/hooks.py index 6a50410f..75d0b9c1 100644 --- a/requests/hooks.py +++ b/requests/hooks.py @@ -8,22 +8,13 @@ This module provides the capabilities for the Requests hooks system. Available hooks: -``pre_request``: - The Request object, directly after being created. - -``pre_send``: - The Request object, directly before being sent. - -``post_request``: - The Request object, directly after being sent. - ``response``: The response generated from a Request. """ -HOOKS = ('pre_prepare', 'post_prepare', 'pre_request', 'pre_send', 'post_request', 'response') +HOOKS = ('response') # TODO: response is the only one def dispatch_hook(key, hooks, hook_data): diff --git a/requests/sessions.py b/requests/sessions.py index 64803289..c2ed48af 100644 --- a/requests/sessions.py +++ b/requests/sessions.py @@ -251,6 +251,9 @@ class Session(SessionMixin): resp = history.pop() resp.history = tuple(history) + # Response manipulation hook. + self.response = dispatch_hook('response', hooks, resp) + return resp