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

Serhiy Storchaka report at bugs.python.org
Sat Mar 21 16:53:45 CET 2015

Serhiy Storchaka added the comment:

The documentation looks contradictory. "The *data* argument must be", but "The *data* argument may also be". "must be a bytes object", but "If *data* is a buffer".

Why not write just "The data argument must be a bytes-like object, an iterable of bytes-like objects, or None"? It doesn't depend if url is a string or a Request object.

AFAIK the data argument of Request can be an iterable of bytes-like objects in additional to a bytes-like object or None.

The note about the application/x-www-form-urlencoded format is applied not only to a bytes object, but to an iterable of bytes-like objects too. I.e. to any acceptable value except None.


Python tracker <report at bugs.python.org>

More information about the docs mailing list