Skip to content

Commit 1e68c60

Browse files
authored
pop the item "Host" in the efficient way
Use `headers.pop("Host", None)` instead of a `if` statement. Signed-off-by: 黃昕暐 <meebox@gmail.com>
1 parent 822b340 commit 1e68c60

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

python-ecosys/requests/requests/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,7 @@ def request(
181181
if redirect:
182182
s.close()
183183
# use the Host in the redirect URL
184-
if "Host" in headers:
185-
headers.pop("Host")
184+
headers.pop("Host", None)
186185
if status in [301, 302, 303]:
187186
return request("GET", redirect, None, None, headers, stream)
188187
else:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy