diff options
author | R David Murray <rdmurray@bitdance.com> | 2014-12-25 02:24:07 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2014-12-25 02:24:07 (GMT) |
commit | 3ab6ba474410b2f49d3a76766999effa59875024 (patch) | |
tree | 2d929ebb78357a5d9044797f7779ca2bd439e848 /Doc/library/urllib.parse.rst | |
parent | 3226f9618f1dfacc7d0a98b0821f8ab5b180e482 (diff) | |
parent | 8c4e112afcf6b2236c43273d007de5b61d4b6519 (diff) | |
download | cpython-3ab6ba474410b2f49d3a76766999effa59875024.zip cpython-3ab6ba474410b2f49d3a76766999effa59875024.tar.gz cpython-3ab6ba474410b2f49d3a76766999effa59875024.tar.bz2 |
Merge: #23040: Clarify treatment of encoding and errors when component is bytes.
Diffstat (limited to 'Doc/library/urllib.parse.rst')
-rw-r--r-- | Doc/library/urllib.parse.rst | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst index 2c3a0b9..3ecdda1 100644 --- a/Doc/library/urllib.parse.rst +++ b/Doc/library/urllib.parse.rst @@ -522,7 +522,7 @@ task isn't already covered by the URL parsing functions above. .. function:: urlencode(query, doseq=False, safe='', encoding=None, errors=None) Convert a mapping object or a sequence of two-element tuples, which may - either be a :class:`str` or a :class:`bytes`, to a "percent-encoded" + contain :class:`str` or :class:`bytes` objects, to a "percent-encoded" string. If the resultant string is to be used as a *data* for POST operation with :func:`~urllib.request.urlopen` function, then it should be properly encoded to bytes, otherwise it would result in a :exc:`TypeError`. @@ -537,8 +537,9 @@ task isn't already covered by the URL parsing functions above. the value sequence for the key. The order of parameters in the encoded string will match the order of parameter tuples in the sequence. - When *query* parameter is a :class:`str`, the *safe*, *encoding* and *error* - parameters are passed down to :func:`quote_plus` for encoding. + The *safe*, *encoding*, and *errors* parameters are passed down to + :func:`quote_plus` (the *encoding* and *errors* parameters are only passed + when a query element is a :class:`str`). To reverse this encoding process, :func:`parse_qs` and :func:`parse_qsl` are provided in this module to parse query strings into Python data structures. |