Skip to content

Commit

Permalink
Merge pull request psf#2504 from pvanderlinden/bug/2503-resolve-redir…
Browse files Browse the repository at this point in the history
…ect-pass-all-arguments

fix resolve redirect to pass all original arguments
  • Loading branch information
Lukasa committed Apr 16, 2015
2 parents 5a799dd + 587eb19 commit a0d9e0b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
3 changes: 2 additions & 1 deletion AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,5 @@ Patches and Suggestions
- Scott Sadler (`@ssadler <https://github.com/ssadler>`_)
- Arthur Darcet (`@arthurdarcet <https://github.com/arthurdarcet>`_)
- Ulrich Petri (`@ulope <https://github.com/ulope>`_)
- Muhammad Yasoob Ullah Khalid <[email protected]> (`@yasoob <https://github.com/yasoob>`_)
- Muhammad Yasoob Ullah Khalid <[email protected]> (`@yasoob <https://github.com/yasoob>`_)
- Paul van der Linden (`@pvanderlinden <https://github.com/pvanderlinden>`_)
14 changes: 3 additions & 11 deletions requests/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def merge_hooks(request_hooks, session_hooks, dict_class=OrderedDict):

class SessionRedirectMixin(object):
def resolve_redirects(self, resp, req, stream=False, timeout=None,
verify=True, cert=None, proxies=None):
verify=True, cert=None, proxies=None, **adapter_kwargs):
"""Receives a Response. Returns a generator of Responses."""

i = 0
Expand Down Expand Up @@ -193,6 +193,7 @@ def resolve_redirects(self, resp, req, stream=False, timeout=None,
cert=cert,
proxies=proxies,
allow_redirects=False,
**adapter_kwargs
)

extract_cookies_to_jar(self.cookies, prepared_request, resp.raw)
Expand Down Expand Up @@ -560,10 +561,6 @@ def send(self, request, **kwargs):
# Set up variables needed for resolve_redirects and dispatching of hooks
allow_redirects = kwargs.pop('allow_redirects', True)
stream = kwargs.get('stream')
timeout = kwargs.get('timeout')
verify = kwargs.get('verify')
cert = kwargs.get('cert')
proxies = kwargs.get('proxies')
hooks = request.hooks

# Get the appropriate adapter to use
Expand Down Expand Up @@ -591,12 +588,7 @@ def send(self, request, **kwargs):
extract_cookies_to_jar(self.cookies, request, r.raw)

# Redirect resolving generator.
gen = self.resolve_redirects(r, request,
stream=stream,
timeout=timeout,
verify=verify,
cert=cert,
proxies=proxies)
gen = self.resolve_redirects(r, request, **kwargs)

# Resolve redirects if allowed.
history = [resp for resp in gen] if allow_redirects else []
Expand Down

0 comments on commit a0d9e0b

Please sign in to comment.