From 2c4849defeda74c191c35c4b1997547b1aae425e Mon Sep 17 00:00:00 2001 From: Alex Chan Date: Mon, 23 Oct 2017 08:30:35 +0100 Subject: [PATCH] Add something to the docs about hooks on Session() --- docs/user/advanced.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/user/advanced.rst b/docs/user/advanced.rst index 613df205..443b43e9 100644 --- a/docs/user/advanced.rst +++ b/docs/user/advanced.rst @@ -458,6 +458,15 @@ Let's print some request method arguments at runtime:: http://httpbin.org +You can also assign hooks to a ``Session`` instance. The hook will then be +called on every request made to the session. For example:: + + >>> s = requests.Session() + >>> s.hooks = dict(response=print_url) + >>> s.get('http://httpbin.org') + http://httpbin.org + + .. _custom-auth: Custom Authentication