Skip to content

Commit 96ba401

Browse files
nateprewittsigmavirus24
authored andcommitted
Only use hostname to do netrc lookup instead of netloc
1 parent 7341690 commit 96ba401

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/requests/utils.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,7 @@ def get_netrc_auth(url, raise_errors=False):
236236
return
237237

238238
ri = urlparse(url)
239-
240-
# Strip port numbers from netloc. This weird `if...encode`` dance is
241-
# used for Python 3.2, which doesn't support unicode literals.
242-
splitstr = b":"
243-
if isinstance(url, str):
244-
splitstr = splitstr.decode("ascii")
245-
host = ri.netloc.split(splitstr)[0]
239+
host = ri.hostname
246240

247241
try:
248242
_netrc = netrc(netrc_path).authenticators(host)

0 commit comments

Comments
 (0)