-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add encoded_string()
method to the URL types
#11580
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
Add encoded_string()
method to the URL types
#11580
Conversation
CodSpeed Performance ReportMerging #11580 will not alter performanceComparing Summary
|
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution. The encoded()
method needs to be added on _BaseMultiHostUrl
as well.
tests/test_networks.py
Outdated
@@ -330,6 +330,7 @@ class Model(BaseModel): | |||
# https://www.xudongz.com/blog/2017/idn-phishing/ accepted but converted | |||
('https://www.аррӏе.com/', 'https://www.xn--80ak6aa92e.com/'), | |||
('https://exampl£e.org', 'https://xn--example-gia.org/'), | |||
('http://puny£code.com', 'http://xn--punycode-eja.com/'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
('http://puny£code.com', 'http://xn--punycode-eja.com/'), |
@Viicos can u take a look on the new _BaseMultiHostUrl test that I have added |
encoded_string()
method to the URL types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution
Change Summary
This PR introduces a new
encoded
property to theUrl
class inpydantic/networks.py
. Theencoded
property returns the punycode-encoded host version of the URL as a string. Additionally, a new test case has been added totests/test_networks.py
to verify the functionality of theencoded
property.Related issue number
fixes #11551
Checklist
The pull request title is a good summary of the changes - it will be used in the changelog
Unit tests for the changes exist
Tests pass on CI
Documentation reflects the changes where applicable
My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers