summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/http.client.rst16
1 files changed, 16 insertions, 0 deletions
diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst
index bc50423..17373a7 100644
--- a/Doc/library/http.client.rst
+++ b/Doc/library/http.client.rst
@@ -521,6 +521,22 @@ Here is an example session that uses the ``GET`` method::
>>> data2 = r2.read()
>>> conn.close()
+Here is an example session that uses ``HEAD`` method. Note that ``HEAD`` method
+never returns any data. ::
+
+
+ >>> import http.client
+ >>> conn = http.client.HTTPConnection("www.python.org")
+ >>> conn.request("HEAD","/index.html")
+ >>> res = conn.getresponse()
+ >>> print(res.status, res.reason)
+ 200 OK
+ >>> data = res.read()
+ >>> print(len(data))
+ 0
+ >>> data == b''
+ True
+
Here is an example session that shows how to ``POST`` requests::
>>> import http.client, urllib.parse