New submission from Martin Panter:

Currently the documentation gives the impression that the “data” parameter to 
Request() has to be in the application/x-www-form-urlencoded format. However I 
suspect that you can override the type by supplying a Content-Type header, and 
I would like to document this; see uploaded patch.

I noticed that test_urllib2.HandlerTests.test_http() already seems to test the 
default Content-Type and a custom Content-Type with a Request() object, 
although I did not see a test for the default Content-Type when supplying 
“data” directly to urlopen().

Also I understand the “charset” parameter on application/x-www-form-urlencoded 
is not standardized. Would it correspond to the encoding of the %XX codes from 
urlencode(), which is typically UTF-8, not Latin-1? Or would it correspond to 
the subsequent string-to-bytes encoding stage, which could just be ASCII since 
non-ASCII characters are already encoded? Maybe it would be best to drop the 
advice to set a “charset” parameter. It was added for Issue 11082.

----------
assignee: docs@python
components: Documentation
files: non-urlencoded.patch
keywords: patch
messages: 235166
nosy: docs@python, vadmium
priority: normal
severity: normal
status: open
title: Content-Type when sending data with urlopen()
versions: Python 3.4
Added file: http://bugs.python.org/file37959/non-urlencoded.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23360>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to