From: Kenneth Reitz Date: Mon, 17 Dec 2012 08:56:58 +0000 (-0500) Subject: response X-Git-Tag: v1.0.0~36 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=03c8e23dbbc6690220141bb685fac08ac9494177;p=services%2Fpython-requests.git response --- diff --git a/requests/hooks.py b/requests/hooks.py index 6a50410..75d0b9c 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 6480328..c2ed48a 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