Skip to content
Myr

Merge pull request #2936 from Lukasa/netrc_with_bytes_url

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

Handle bytes and unicode URLs for netloc

authored by Ian Cordasco · committed by Ian Cordasco · parents f7cb796, 6e0649d · Browse files · 1 file+6 added−2 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+6 added−2 removed

  • other:+6 added−2 removed

1 file+6 added−2 removed

modified:requests/utils.py+6 added-2 removed
113 unmodified lines
114 return115116 ri = urlparse(url)117118 # Strip port numbers from netloc119 host = ri.netloc.split(':')[0]118 # Strip port numbers from netloc. This weird `if...encode`` dance is119 # used for Python 3.2, which doesn't support unicode literals.120 splitstr = b':'121 if isinstance(url, str):122 splitstr = splitstr.decode('ascii')123 host = ri.netloc.split(splitstr)[0]124125 try:126 _netrc = netrc(netrc_path).authenticators(host)127 if _netrc:
594 unmodified lines