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
unusual url string crashs is py3 #4168
Comments
For posterity, the complete traceback is this:
I don't think there's much we can do about this. The error is coming out of the standard library (specifically, in the urllib The only way we can fix this is by moving to a much smarter URL handling implementation that normalizes URLs in some form. The best candidate is hyperlink, but hyperlink also barfs on this for a similar reason (it tries to IDNA-encode and fails). This means that at best we could fix this by extending hyperlink with a URL host normalizer and then handle it. However, the WHATWG URL specification also appears to forbid this form of URL. If it does I'm not sure why, as Chrome normalizes it (though Safari does not). Given the amount of work required to do this, I don't see any reason to tolerate it. The URL is just spectacularly far away from anything that can reasonably be expected to work, so I'm inclined to just close this as a won't fix. |
I'm encountering this for a URL of the format:
and length of 132 characters. |
@johnpaulhayes That's still not an issue with the requests library, but as I'm also running into it I figure I'll drop an update. It's not the total length of the url that seems to do it, just a section of it. The idna encoder seems to break on urls when the first part of the host name is greater than 64 characters long. For whatever reason, it's including the key and secret in there as well. So either avoid python3 or avoid long "key:secret@example" strings (likely by avoiding long api keys) until the underlying functions are fixed. I submitted a bug for it to the python tracker yesterday. |
Due to psf/requests#4168, using https://user:password@url makes the URL too long and results in a UnicodeError: "label empty or too long". The workaround is to avoid specifying it in the URL and to use an alternate mechanism of supplying credentials e.g. .netrc.
For those interested in the issue on the python side |
I installed the current master by pip install zipfile in a recent python3 conda environment
base_url = 'http://............127.0.0.1:8082'
request.get(base_url)
crashes
and ends with an UnidodeError
python3.6/encodings/idna.py",
line 165, in encode
raise UnicodeError("label empty or too long")
UnicodeError: label empty or too long
May be you can catch this?
The text was updated successfully, but these errors were encountered: