Skip to content
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

Update http.client.rst #24803

Merged
merged 4 commits into from
Oct 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions Doc/library/http.client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ The module provides the following classes:

.. versionchanged:: 3.4
The *strict* parameter was removed. HTTP 0.9-style "Simple Responses" are
not longer supported.
no longer supported.

.. versionchanged:: 3.7
*blocksize* parameter was added.
Expand Down Expand Up @@ -474,7 +474,7 @@ statement.

Return the value of the header *name*, or *default* if there is no header
matching *name*. If there is more than one header with the name *name*,
return all of the values joined by ', '. If 'default' is any iterable other
return all of the values joined by ', '. If *default* is any iterable other
than a single string, its elements are similarly returned joined by commas.

.. method:: HTTPResponse.getheaders()
Expand Down Expand Up @@ -578,7 +578,7 @@ Here is an example session that uses the ``HEAD`` method. Note that the
>>> data == b''
True

Here is an example session that shows how to ``POST`` requests::
Here is an example session that uses the ``POST`` method::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?


>>> import http.client, urllib.parse
>>> params = urllib.parse.urlencode({'@number': 12524, '@type': 'issue', '@action': 'show'})
Expand All @@ -594,14 +594,13 @@ Here is an example session that shows how to ``POST`` requests::
b'Redirecting to <a href="https://bugs.python.org/issue12524">https://bugs.python.org/issue12524</a>'
>>> conn.close()

Client side ``HTTP PUT`` requests are very similar to ``POST`` requests. The
difference lies only the server side where HTTP server will allow resources to
be created via ``PUT`` request. It should be noted that custom HTTP methods
Client side HTTP ``PUT`` requests are very similar to ``POST`` requests. The
difference lies only on the server side where HTTP servers will allow resources to
be created via ``PUT`` requests. It should be noted that custom HTTP methods
are also handled in :class:`urllib.request.Request` by setting the appropriate
method attribute. Here is an example session that shows how to send a ``PUT``
request using http.client::
method attribute. Here is an example session that uses the ``PUT`` method::

>>> # This creates an HTTP message
>>> # This creates an HTTP request
Copy link
Member

@merwok merwok Jan 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

request is the abstract concept, but message is a type in this module, and used just below in the doc.
This line was not incorrect, I suggest reverting the change.

>>> # with the content of BODY as the enclosed representation
>>> # for the resource http://localhost:8080/file
...
Expand Down