-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
urllib data URL #60627
Comments
I think it would be really helpful if urllib would support data URLs. However, I was told on the python-ideas mailing list that it would probably only added as recipe in the documentation. The attached patch adds such an recipe to the urllib.request documentation. I've never written a doc patch (or any patch) for python before, so I don't know if I added it at the right place in the right format. |
New patch. Instead of adding the data URL support to the doc as a recipe I added it to urllib.request directly. I think this is better and justified, because the old legacy URLopener had (some kind) of support for data URLs. OT: I think that the legacy URLopener has bugs. It only unquotes the data if it's base64 encoded, but it should be unquoted in any case. Also it returns a StringIO and decodes the content as latin-1. This is wrong, the content is a binary string. It could be text encoded in any kind of charset or not text at all (e.g. an image). |
A couple of comments:
+1 on the general idea, by the way. |
On 11/18/2012 12:36 AM, Antoine Pitrou wrote:
Will do (when I have time).
I did that because that's what the old URLopener code does (ignoring POSTed data and raising an
|
Ok. I think it's better to take a fresh start here :-) |
On 11/18/2012 12:36 AM, Antoine Pitrou wrote:
Btw.: The file:// protocol handler also just ignores posted data, so I think the data url handler |
Ok, I've added a documentation and some tests. Is it ok this way? More tests? More/other documentation? |
Ah, fair enough, then. Thanks for the updated patch, I'll take a look |
New changeset a182367eac5a by Antoine Pitrou in branch 'default': |
I've committed your patch after having made the few very minor changes mentioned in the review. Thank you very much! |
Great! Feels awesome to have my first bit of code contributed to the Python project. :) |
You're welcome! We're always happy to have new contributors. I've forgotten something: could you sign a contributor agreement? |
Will do (later today). |
Hmm, which of the two initial licenses should I choose? Which one do you rather want me to choose? |
Whichever you prefer. They should be equivalent in their terms |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: