Skip to content
Myr

Do not pass cookies to resolve_redirects

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

SessionRedirectMixin is extending Session, so we can just use self.cookies.

authored by Miikka Koskinen · committed by Miikka Koskinen · parent 5bb2be9 · Browse files · 1 file+3 added−4 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+3 added−4 removed

  • other:+3 added−4 removed

1 file+3 added−4 removed

modified:requests/sessions.py+3 added-4 removed
78 unmodified lines
798081class SessionRedirectMixin(object):82 def resolve_redirects(self, resp, req, stream=False, timeout=None,83 verify=True, cert=None, proxies=None, cookies=None):83 verify=True, cert=None, proxies=None):84 """Receives a Response. Returns a generator of Responses."""8586 i = 087 prepared_request = PreparedRequest()
3 unmodified lines
91 prepared_request.method = req.method92 prepared_request.url = req.url9394 cookiejar = cookiejar_from_dict({})95 cookiejar.update(cookies)95 cookiejar.update(self.cookies)96 cookiejar.update(resp.cookies)9798 # ((resp.status_code is codes.see_other))99 while (('location' in resp.headers and resp.status_code in REDIRECT_STATI)):
310 unmodified lines
410 verify = kwargs.get('verify')411 cert = kwargs.get('cert')412 proxies = kwargs.get('proxies')413 hooks = request.hooks414 cookies = self.cookies414415 # Get the appropriate adapter to use416 adapter = self.get_adapter(url=request.url)417
9 unmodified lines
427428 # Redirect resolving generator.429 gen = self.resolve_redirects(r, request, stream=stream,430 timeout=timeout, verify=verify, cert=cert,432 proxies=proxies, cookies=cookies)431 proxies=proxies)432433 # Resolve redirects if allowed.434 history = [resp for resp in gen] if allow_redirects else []435
41 unmodified lines