-
Notifications
You must be signed in to change notification settings - Fork 42
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 and test URL.__str__, which enables URLs to be passed directly to… #55
Conversation
… libaries which stringify (like requests). fixes #49.
Codecov Report
@@ Coverage Diff @@
## master #55 +/- ##
=========================================
+ Coverage 97.76% 97.8% +0.03%
=========================================
Files 6 6
Lines 1118 1137 +19
Branches 135 137 +2
=========================================
+ Hits 1093 1112 +19
Misses 13 13
Partials 12 12
Continue to review full report at Codecov.
|
Rather than adding the "some libraries are bad at IRIs" in a private docstring that I guarantee you no one will ever read, if the goal here is |
The "some libraries are bad at IRIs" is just a hint of a glimmer of something I remember, combined with general suspicion. I'm fine with the always |
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.
Please file a follow-up ticket to add documentation showing that this is an intentional integration point with Requests.
(And we should probably make sure it works with Treq too, although I'm not sure if it does right now.)
This
URL.__str__()
enables URLs to be passed directly to libaries which stringify (like requests), as brought up by issue #49.I've opted to keep it simple and have Python 2's
__str__
(Py3's__bytes__()
) return the UTF-8 encoded version ofURL.to_text()
. This means that when printed on terminals configured to display UTF-8, the user will get a copy-and-pastable URL.I also considered making
__str__
return the ASCII-encodedURL.to_url().to_text()
, but this would have the property of obscuring special characters and possibly falsely-equating URIs and IRIs, contrary to hyperlink's longstanding design.