mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
response
This commit is contained in:
+1
-10
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user