-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'127.0.0.1:8329' parsed wrong in Python 3.9+ #155
Comments
This is my solution on our code, until import furl
def urlsplit_based_on_urllib3(url):
"""
Returns same values as `urllib.parse.urlsplit` returns before Python3.9
>>> urlsplit_based_on_urllib3('127.0.0.1:8329')
(None, None, '127.0.0.1:8329', None, None)
"""
from urllib3.util import parse_url
u = parse_url(url)
if u.netloc and not u.path:
return u.scheme, None, u.netloc, u.query, u.fragment
return u.scheme, u.netloc, u.path, u.query, u.fragment
try:
furl.urllib.parse.urlsplit = urlsplit_based_on_urllib3
except:
logger.error("Failed to fix furl urlsplit usage")
|
thank you for opening this issue! great catch, and thank you for providing the super helpful links for context let's fix this; consistency is key. do you have time to submit a PR which replaces furl's version of thank you! |
Using urllib3 may not be ideal because that project officially supports only HTTP URLs. |
This is due to a fix that was done on Python3.9 (python/cpython#71844) that changed the
scheme
field in case noscheme
is provided.This fix also broke requests behavior and they had to replace their parsing method, with
urllib3
(psf/requests#5917).I suggest to fix this issue with
urllib3
tooThe text was updated successfully, but these errors were encountered: