Add convenience / utility methods to urllib.parse's structured result objects
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 28/100
Hướng nghiên cứu
Bắt đầu với các đối tượng kết quả có cấu trúc và các mixin hiện có của urllib.parse, sau đó xem xét các tiện ích werkzeug.urls được liên kết để so sánh. Công việc được xem là hoàn tất khi tập hợp helper được đề xuất và hành vi của chúng được thu hẹp vào một phạm vi đã thống nhất, bao gồm cả các cập nhật query và mọi helper URL hoặc userinfo được chọn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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)
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 36k
- Merge trung bình
- 1 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 558
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của python/cpython
-
docs pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
stdlib type-feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
stdlib type-feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
build type-bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
stdlib topic-email type-feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Tất cả issue của python/cpython
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
PolicyEngine/policyengine-us#9559 ·
-
priority: p3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
googleapis/librarian#7636 ·
-
from:qa priority:P2 reliability tech-debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
spec-kitty/spec-kitty#4874 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100