import logging
from io import BytesIO
-from .hooks import default_hooks, HOOKS
+from .hooks import default_hooks
from .structures import CaseInsensitiveDict
from .status_codes import codes
# Prepare the Request.
prep = req.prepare()
- # If auth hooks are present, they aren't passed to `dispatch_hook`
- # As such, we need to update the original hooks dictionary with them
- hooks.update(prep.hooks)
-
# Send the request.
resp = self.send(prep, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies)
resp = history.pop()
resp.history = tuple(history)
- # Response manipulation hook.
- resp = dispatch_hook('response', hooks, resp)
-
return resp
def get(self, url, **kwargs):
def send(self, request, **kwargs):
"""Send a given PreparedRequest."""
+ hooks = request.hooks
adapter = self.get_adapter(url=request.url)
r = adapter.send(request, **kwargs)
+ # Response manipulation hooks
+ r = dispatch_hook('response', hooks, r)
return r
def get_adapter(self, url):