Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 10427f4

Browse files
committed
[merge from 3.5] - Issue28010 - Make http.client.HTTPConnection.putrequest
documentation consistent with the code.
2 parents 3929499 + 5dc504c commit 10427f4

2 files changed

Lines changed: 11 additions & 16 deletions

File tree

Doc/library/http.client.rst

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ HTTPS protocols. It is normally not used directly --- the module
3131
The module provides the following classes:
3232

3333

34-
.. class:: HTTPConnection(host, port=None[, timeout], \
35-
source_address=None)
34+
.. class:: HTTPConnection(host, port=None[, timeout], source_address=None)
3635

3736
An :class:`HTTPConnection` instance represents one transaction with an HTTP
3837
server. It should be instantiated passing it a host and optional port
@@ -196,7 +195,6 @@ The constants defined in this module are:
196195

197196
The default port for the HTTP protocol (always ``80``).
198197

199-
200198
.. data:: HTTPS_PORT
201199

202200
The default port for the HTTPS protocol (always ``443``).
@@ -340,14 +338,15 @@ As an alternative to using the :meth:`request` method described above, you can
340338
also send your request step by step, by using the four functions below.
341339

342340

343-
.. method:: HTTPConnection.putrequest(request, selector, skip_host=False, skip_accept_encoding=False)
341+
.. method:: HTTPConnection.putrequest(method, url, skip_host=False, \
342+
skip_accept_encoding=False)
344343

345-
This should be the first call after the connection to the server has been made.
346-
It sends a line to the server consisting of the *request* string, the *selector*
347-
string, and the HTTP version (``HTTP/1.1``). To disable automatic sending of
348-
``Host:`` or ``Accept-Encoding:`` headers (for example to accept additional
349-
content encodings), specify *skip_host* or *skip_accept_encoding* with non-False
350-
values.
344+
This should be the first call after the connection to the server has been
345+
made. It sends a line to the server consisting of the *method* string,
346+
the *url* string, and the HTTP version (``HTTP/1.1``). To disable automatic
347+
sending of ``Host:`` or ``Accept-Encoding:`` headers (for example to accept
348+
additional content encodings), specify *skip_host* or *skip_accept_encoding*
349+
with non-False values.
351350

352351

353352
.. method:: HTTPConnection.putheader(header, argument[, ...])
@@ -425,7 +424,6 @@ statement.
425424
return all of the values joined by ', '. If 'default' is any iterable other
426425
than a single string, its elements are similarly returned joined by commas.
427426

428-
429427
.. method:: HTTPResponse.getheaders()
430428

431429
Return a list of (header, value) tuples.
@@ -440,22 +438,18 @@ statement.
440438
headers. :class:`http.client.HTTPMessage` is a subclass of
441439
:class:`email.message.Message`.
442440

443-
444441
.. attribute:: HTTPResponse.version
445442

446443
HTTP protocol version used by server. 10 for HTTP/1.0, 11 for HTTP/1.1.
447444

448-
449445
.. attribute:: HTTPResponse.status
450446

451447
Status code returned by server.
452448

453-
454449
.. attribute:: HTTPResponse.reason
455450

456451
Reason phrase returned by server.
457452

458-
459453
.. attribute:: HTTPResponse.debuglevel
460454

461455
A debugging hook. If :attr:`debuglevel` is greater than zero, messages

Lib/http/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,8 @@ def _send_output(self, message_body=None, encode_chunked=False):
10681068
# end chunked transfer
10691069
self.send(b'0\r\n\r\n')
10701070

1071-
def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0):
1071+
def putrequest(self, method, url, skip_host=False,
1072+
skip_accept_encoding=False):
10721073
"""Send a request to the server.
10731074
10741075
`method' specifies an HTTP request method, e.g. 'GET'.

0 commit comments

Comments
 (0)