class documentation

class SessionRedirectMixin(object):

Known subclasses: requests.sessions.Session

View In Hierarchy

Undocumented

Method get​_redirect​_target Receives a Response. Returns a redirect URI or None
Method rebuild​_auth When being redirected we may want to strip authentication from the request to avoid leaking credentials. This method intelligently removes and reapplies authentication where possible to avoid credential loss.
Method rebuild​_method When being redirected we may want to change the method of the request based on certain specs or browser behavior.
Method rebuild​_proxies No summary
Method resolve​_redirects Receives a Response. Returns a generator of Responses or Requests.
Method should​_strip​_auth Decide whether Authorization header should be removed when redirecting
def get_redirect_target(self, resp):
Receives a Response. Returns a redirect URI or None
def rebuild_auth(self, prepared_request, response):
When being redirected we may want to strip authentication from the request to avoid leaking credentials. This method intelligently removes and reapplies authentication where possible to avoid credential loss.
def rebuild_method(self, prepared_request, response):
When being redirected we may want to change the method of the request based on certain specs or browser behavior.
def rebuild_proxies(self, prepared_request, proxies):

This method re-evaluates the proxy configuration by considering the environment variables. If we are redirected to a URL covered by NO_PROXY, we strip the proxy configuration. Otherwise, we set missing proxy keys for this URL (in case they were stripped by a previous redirect).

This method also replaces the Proxy-Authorization header where necessary.

Returns
dictUndocumented
def resolve_redirects(self, resp, req, stream=False, timeout=None, verify=True, cert=None, proxies=None, yield_requests=False, **adapter_kwargs):
Receives a Response. Returns a generator of Responses or Requests.
def should_strip_auth(self, old_url, new_url):
Decide whether Authorization header should be removed when redirecting