mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
@@ -13,7 +13,6 @@ import socket
|
||||
from .models import Response
|
||||
from .packages.urllib3.poolmanager import PoolManager, ProxyManager
|
||||
from .packages.urllib3.response import HTTPResponse
|
||||
from .hooks import dispatch_hook
|
||||
from .compat import urlparse, basestring, urldefrag
|
||||
from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers,
|
||||
prepend_scheme_if_needed)
|
||||
@@ -109,8 +108,6 @@ class HTTPAdapter(BaseAdapter):
|
||||
response.request = req
|
||||
response.connection = self
|
||||
|
||||
# Run the Response hook.
|
||||
response = dispatch_hook('response', req.hooks, response)
|
||||
return response
|
||||
|
||||
def get_connection(self, url, proxies=None):
|
||||
|
||||
@@ -275,6 +275,10 @@ class Session(SessionRedirectMixin):
|
||||
# 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)
|
||||
|
||||
@@ -295,7 +299,7 @@ class Session(SessionRedirectMixin):
|
||||
resp.history = tuple(history)
|
||||
|
||||
# Response manipulation hook.
|
||||
self.response = dispatch_hook('response', hooks, resp)
|
||||
resp = dispatch_hook('response', hooks, resp)
|
||||
|
||||
return resp
|
||||
|
||||
|
||||
Reference in New Issue
Block a user