Skip to content
Myr

Applied new hooks api

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Luca De Vitis · committed by Luca De Vitis · parent 335bf70 · Browse files · 1 file+6 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−7 removed

  • other:+6 added−7 removed

1 file+6 added−7 removed

modified:requests/api.py+6 added-7 removed
41 unmodified lines
42 """4344 method = str(method).upper()4546 cookies = cookiejar_from_dict(cookies or dict())46 cookies = cookiejar_from_dict(cookies if cookies is not None else dict())4748 hooks = setup_hooks(hooks or dict())4948 args = dict(49 method = method,50 url = url,51 data = data,
6 unmodified lines
58 allow_redirects = allow_redirects,59 proxies = proxies or config.settings.proxies,60 )61 62 hooks = setup_hooks(hooks if hooks is not None else dict())6364 # Arguments manipulation hook.66 args = dispatch_hooks(hooks.get('args', []), args)65 args = dispatch_hooks(hooks['args'], args)6667 r = Request(**args)6869 # Pre-request hook.71 r = dispatch_hooks(hooks.get('pre_request', []), r)70 r = dispatch_hooks(hooks['pre_request'], r)7172 # Send the HTTP Request.73 r.send()7475 # Post-request hook.77 r = dispatch_hooks(hooks.get('post_request', []), hooks, r)76 r = dispatch_hooks(hooks['post_request'], r)7778 # Response manipulation hook.80 r.response = dispatch_hooks(hooks.get('response', []), r.response)79 r.response = dispatch_hooks(hooks['response'], r.response)8081 return r.response8283
62 unmodified lines