[docs] [issue23360] Content-Type when sending data with urlopen()

Martin Panter report at bugs.python.org
Sun Feb 1 13:43:32 CET 2015


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 at python
components: Documentation
files: non-urlencoded.patch
keywords: patch
messages: 235166
nosy: docs at 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 <report at bugs.python.org>
<http://bugs.python.org/issue23360>
_______________________________________


More information about the docs mailing list