You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The question here is whether the validation should or should not be implicit when using uri_reference. The truth is that it parses the URI and returns an invalid result by default:
My mistake; using ParseResult.from_string fixes this. I should have read the docs more thoroughly.
Why is it that we have a non-validating parser? Some large projects (httpx) use this parser, and would probably be better off using ParseResult.from_string.
Activity
kenballus commentedon Feb 7, 2023
Also a problem when host is '['
sigmavirus24 commentedon Feb 15, 2023
Happy to accept a fix here
frenzymadness commentedon Apr 18, 2023
The question here is whether the validation should or should not be implicit when using
uri_reference. The truth is that it parses the URI and returns an invalid result by default:But you can simply check the validity of the result by the
is_valid()method:If you want the validation to happen immediately during parsing, you can use
ParseResult:So, because the lib is already able to say that the URL is invalid, it's more a design decision if the validation should happen by default.
sigmavirus24 commentedon Apr 18, 2023
Pretty sure
uri_referencewas always intended to be non-validating so that the rest could be API compatible with urllib3 more or less.Maybe we need to make that clearer in the docs
frenzymadness commentedon Apr 18, 2023
@kenballus could you please clarify which approach did you use?
kenballus commentedon Apr 19, 2023
My mistake; using
ParseResult.from_stringfixes this. I should have read the docs more thoroughly.Why is it that we have a non-validating parser? Some large projects (httpx) use this parser, and would probably be better off using
ParseResult.from_string.