mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
Handle bytes and unicode URLs for netloc
This commit is contained in:
+4
-1
@@ -116,7 +116,10 @@ def get_netrc_auth(url, raise_errors=False):
|
||||
ri = urlparse(url)
|
||||
|
||||
# Strip port numbers from netloc
|
||||
host = ri.netloc.split(':')[0]
|
||||
if isinstance(url, str):
|
||||
host = ri.netloc.split(u':')[0]
|
||||
else:
|
||||
host = ri.netloc.split(b':')[0]
|
||||
|
||||
try:
|
||||
_netrc = netrc(netrc_path).authenticators(host)
|
||||
|
||||
Reference in New Issue
Block a user