Skip to content

Commit

Permalink
Remove what appears to be an un-needed call to self.resolve_redirects…
Browse files Browse the repository at this point in the history
… when not following redirects as part of creating a request's history.
  • Loading branch information
dbaxa committed Jun 15, 2020
1 parent 9ed5db8 commit fa2dbe9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions requests/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,11 +658,13 @@ def send(self, request, **kwargs):

extract_cookies_to_jar(self.cookies, request, r.raw)

# Redirect resolving generator.
gen = self.resolve_redirects(r, request, **kwargs)

# Resolve redirects if allowed.
history = [resp for resp in gen] if allow_redirects else []
if allow_redirects:
# Redirect resolving generator.
gen = self.resolve_redirects(r, request, **kwargs)
history = [resp for resp in gen]
else:
history = []

# Shuffle things around if there's history.
if history:
Expand Down

0 comments on commit fa2dbe9

Please sign in to comment.