summaryrefslogtreecommitdiff
path: root/docs/user
diff options
context:
space:
mode:
authorAlex Chan <a.chan@wellcome.ac.uk>2017-10-23 08:30:35 +0100
committerAlex Chan <a.chan@wellcome.ac.uk>2017-10-23 08:30:35 +0100
commit2c4849defeda74c191c35c4b1997547b1aae425e (patch)
treeb552b8d1a726bd336070392c3c20850ce57c074e /docs/user
parentc4c031fc5c62fac25c155e6870962736eb363dc9 (diff)
downloadpython-requests-2c4849defeda74c191c35c4b1997547b1aae425e.tar.gz
Add something to the docs about hooks on Session()
Diffstat (limited to 'docs/user')
-rw-r--r--docs/user/advanced.rst9
1 files changed, 9 insertions, 0 deletions
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
<Response [200]>
+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
+ <Response [200]>
+
.. _custom-auth:
Custom Authentication