Add convenience / utility methods to urllib.parse's structured result objects
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 28/100
Research direction
Start with urllib.parse's structured result objects and existing mixins, then review the linked werkzeug.urls utilities for comparison. Done means the proposed helper set and behavior are narrowed to an agreed scope, including query updates and any selected URL or userinfo helpers.
Written by the indexing model from the issue text.
Description
Currently, non-trivial URL manipulations require going back and forth between structured results and utility functions in order to process or manipulate the URL in non-trivial ways (other than entirely replacing one of the attributes).
werkzeug.urls (which started as a cross-version compatibility shim) shows a few utility properties and methods:
join, which performs a Resutl -> Result urljoindecode_query, which performs aparse_qs(-l, kind-of, as werkzeug uses multidicts)ascii_host, which return a punycode/idna-encoded domain if necessaryauth, which returns the encoded userinfo
The first three are commonly useful, and require a fair amount of syntactic overhead to perform using the stdlib. The 4th would mostly be solved by making _userinfo public / stable and documenting it, though a purely textual version could also be useful.
One utility which I think is missing from werkzeug and would also be useful is a shortcut to set/update query string parameters directly, which IME is quite common: looking at a pretty url-heavy codebase, 20~30% of the querystring manipulations are straighforward set-and-forget (the rest is lookups, with a few odd more complicated manipulations of the query string which do need to fully decode and process the result).
As urllib.parse already layers a few mixins on top of the base namedtuples, I don't think this would incur significant runtime costs (the helpers could probably be added to existing mixins)
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 36k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 558
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python/cpython
-
docs pending
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
stdlib type-feature
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
stdlib type-feature
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
build type-bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
stdlib topic-email type-feature
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
🐛 Bug 🔔 Pending processing
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
jumpserver/jumpserver#17584 ·