Skip to content
Myr

Only call the hook once.

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

authored by Ian Cordasco · committed by Ian Cordasco · parent e771aa9 · Browse files · 2 files+4 added−8 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+4 added−8 removed

  • other:+4 added−8 removed

2 files+4 added−8 removed

modified:requests/models.py+1 added-1 removed
9 unmodified lines
10import collections11import logging1213from io import BytesIO14from .hooks import default_hooks, HOOKS14from .hooks import default_hooks15from .structures import CaseInsensitiveDict16from .status_codes import codes1718from .auth import HTTPBasicAuth
636 unmodified lines
modified:requests/sessions.py+3 added-7 removed
274 unmodified lines
275276 # Prepare the Request.277 prep = req.prepare()278279 # If auth hooks are present, they aren't passed to `dispatch_hook`280 # As such, we need to update the original hooks dictionary with them281 hooks.update(prep.hooks)282279 # Send the request.280 resp = self.send(prep, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies)281282 # Persist cookies.
11 unmodified lines
294 history.insert(0, resp)295 resp = history.pop()296 resp.history = tuple(history)297302 # Response manipulation hook.303 resp = dispatch_hook('response', hooks, resp)304298 return resp299300 def get(self, url, **kwargs):301 """Sends a GET request. Returns :class:`Response` object.
65 unmodified lines
367 return self.request('DELETE', url, **kwargs)368369 def send(self, request, **kwargs):370 """Send a given PreparedRequest."""371 hooks = request.hooks372 adapter = self.get_adapter(url=request.url)373 r = adapter.send(request, **kwargs)374 # Response manipulation hooks375 r = dispatch_hook('response', hooks, r)376 return r377378 def get_adapter(self, url):379 """Returns the appropriate connnection adapter for the given URL."""
29 unmodified lines