Skip to content
Myr

Merge pull request #4206 from jvanasco/feature-redirects

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

some docs on request redirect detection

authored by Cory Benfield · committed by GitHub · parents 2b6f1e6, 667896c · Browse files · 1 file+6 added−0 removed
This commit

State

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

Diff stats

1 file+6 added−0 removed

  • other:+6 added−0 removed

1 file+6 added−0 removed

modified:requests/sessions.py+6 added
95 unmodified lines
96class SessionRedirectMixin(object):9798 def get_redirect_target(self, resp):99 """Receives a Response. Returns a redirect URI or ``None``"""100 # Due to the nature of how requests processes redirects this method will101 # be called at least once upon the original response and at least twice102 # on each subsequent redirect response (if any).103 # If a custom mixin is used to handle this logic, it may be advantageous104 # to cache the redirect location onto the response object as a private105 # attribute.106 if resp.is_redirect:107 location = resp.headers['location']108 # Currently the underlying http module on py3 decode headers109 # in latin1, but empirical evidence suggests that latin1 is very
628 unmodified lines