Skip to content
Myr

pre-send hook

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

#516

authored by Kenneth Reitz · committed by Kenneth Reitz · parent efe5d13 · Browse files · 2 files+8 added−1 removed
This commit

State

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

Diff stats

2 files+8 added−1 removed

  • other:+8 added−1 removed

2 files+8 added−1 removed

modified:requests/hooks.py+4 added-1 removed
10 unmodified lines
11``args``:12 A dictionary of the arguments being sent to Request().1314``pre_request``:15 The Request object, directly after being created.1617``pre_send``:18 The Request object, directly before being sent.1920``post_request``:21 The Request object, directly after being sent.
5 unmodified lines
2728import traceback293028HOOKS = ('args', 'pre_request', 'post_request', 'response')31HOOKS = ('args', 'pre_request', 'pre_send', 'post_request', 'response')323334def dispatch_hook(key, hooks, hook_data):35 """Dispatches a hook dictionary on a given piece of data."""
16 unmodified lines
modified:requests/models.py+4 added
568 unmodified lines
569 cookie_header = get_cookie_header(self.cookies, self)570 if cookie_header is not None:571 self.headers['Cookie'] = cookie_header572573 # Pre-send hook.574 r = dispatch_hook('pre_send', self.hooks, self)575 self.__dict__.update(r.__dict__)576577 try:578 # The inner try .. except re-raises certain exceptions as579 # internal exception types; the outer suppresses exceptions580 # when safe mode is set.
261 unmodified lines