Skip to content
Myr

epic redirect generator is epic

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

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 0bee888 · Browse files · 1 file+7 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

1 file+7 added−8 removed

  • other:+7 added−8 removed

1 file+7 added−8 removed

modified:requests/sessions.py+7 added-8 removed
66 unmodified lines
6768 def resolve_redirects(self, resp, req, prefetch=True, timeout=None, verify=True, cert=None):69 """Receives a Response. Returns a generator of Responses."""7071 print resp72 print req73 print resp.headers['location']74 print resp.status_code7172 # ((resp.status_code is codes.see_other))73 while (('location' in resp.headers and resp.status_code in REDIRECT_STATI)):74
177 unmodified lines
252 # TODO: prepare cookies.253254 resp = self.send(prep)255260 if allow_redirects:261 gen = self.resolve_redirects(resp, req, prefetch, timeout, verify, cert)256 # Redirect generator.257 gen = self.resolve_redirects(resp, req, prefetch, timeout, verify, cert)258263 history = [r for r in gen]259 history = [r for r in gen] if allow_redirects else []260265 print history261 if history:262 history.insert(0, resp)263 resp = history.pop()264 resp.history = history265266 return resp267268
94 unmodified lines