PyDocs

Nav

Internet Protocols and Support

HTTPConnection.request

http.client

method of HTTPConnection (source) not WASI
  • HTTPConnection.request(method, url, body=None, headers={}, *, encode_chunked=False)
Send a complete request to the server.
Changed in 3.2, 3.6
  • 3.2: body can now be an iterable.
  • 3.6: If neither Content-Length nor Transfer-Encoding are set in headers, file and iterable body objects are now chunk-encoded. The encode_chunked argument was added. No attempt is made to determine the Content-Length for file objects.
1 Example
>>> import http.client
>>> host = "docs.python.org"
>>> conn = http.client.HTTPSConnection(host)
>>> conn.request("GET", "/3/", headers={"Host": host})
>>> response = conn.getresponse()
>>> print(response.status, response.reason)
200 OK
from the Python docs
See Also
No see-alsos for http.client/HTTPConnection.request
0 Notes
No notes for HTTPConnection.request