diff options
| author | Alex Chan <a.chan@wellcome.ac.uk> | 2017-10-23 13:25:31 +0100 |
|---|---|---|
| committer | Alex Chan <a.chan@wellcome.ac.uk> | 2017-10-23 13:25:31 +0100 |
| commit | 87f3b0a5595d875515de15927e1d2803dbfda73c (patch) | |
| tree | f23ec91b56dc70f0853eb0c9e634c318e4e276a8 /docs | |
| parent | 2c4849defeda74c191c35c4b1997547b1aae425e (diff) | |
| download | python-requests-87f3b0a5595d875515de15927e1d2803dbfda73c.tar.gz | |
Switch to using dict literals, it's 2017
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/user/advanced.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/user/advanced.rst b/docs/user/advanced.rst index 443b43e9..93f86baa 100644 --- a/docs/user/advanced.rst +++ b/docs/user/advanced.rst @@ -436,7 +436,7 @@ You can assign a hook function on a per-request basis by passing a ``{hook_name: callback_function}`` dictionary to the ``hooks`` request parameter:: - hooks=dict(response=print_url) + hooks={'response': print_url} That ``callback_function`` will receive a chunk of data as its first argument. @@ -454,7 +454,7 @@ anything, nothing else is effected. Let's print some request method arguments at runtime:: - >>> requests.get('http://httpbin.org', hooks=dict(response=print_url)) + >>> requests.get('http://httpbin.org', hooks={'response': print_url}) http://httpbin.org <Response [200]> @@ -462,7 +462,7 @@ 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.hooks['response'].append(print_url) >>> s.get('http://httpbin.org') http://httpbin.org <Response [200]> |
