PyDocs

Nav

Internet Protocols and Support

HTTPConnection.close

http.client

method of HTTPConnection (source) not WASI
  • HTTPConnection.close()
Close the connection to the HTTP server.
1 Example
>>> import http.client, urllib.parse
>>> params = urllib.parse.urlencode({'@number': 12524, '@type': 'issue', '@action': 'show'})
>>> headers = {"Content-type": "application/x-www-form-urlencoded",
...            "Accept": "text/plain"}
>>> conn = http.client.HTTPConnection("bugs.python.org")
>>> conn.request("POST", "", params, headers)
>>> response = conn.getresponse()
>>> print(response.status, response.reason)
302 Found
>>> data = response.read()
>>> data
b'Redirecting to <a href="https://bugs.python.org/issue12524">https://bugs.python.org/issue12524</a>'
>>> conn.close()
from the Python docs
See Also
No see-alsos for http.client/HTTPConnection.close
0 Notes
No notes for HTTPConnection.close