Skip to content

Soft deprecate urllib.parse.urlparse() #144148

@serhiy-storchaka

Description

@serhiy-storchaka

urlparse() is similar to urlsplit(), but additionally it splits path on path and params using the ";" separator. This is wrong. First, the corresponding RFCs (RFC 3986, RFC 8820) do not list "params" as a separate URI component. Second, the ";" separator is used to specify parameters for a path segment, not the whole path. And this is scheme-specific, most schemes don't use it or use "," for similar purpose. It is mentioned in RFC 3986, but not in RFC 8820.

So, it is better to use urlsplit() and then parse path if needed. I afraid that most users of urlparse() are not aware of this, and only use it because it have more attractive name than urlsplit().

We should clearly document urlparse() as obsolete.

cc @orsenthil

Linked PRs

Metadata

Metadata

Labels

3.15new features, bugs and security fixesdocsDocumentation in the Doc dir

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions