summaryrefslogtreecommitdiffstats
path: root/Doc/library/http.client.rst
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-05-03 17:00:37 (GMT)
committerBenjamin Peterson <benjamin@python.org>2015-05-03 17:00:37 (GMT)
commitb174b85c1a37ee7452d26d041c30519425e4d421 (patch)
treee40fa218c2c64a10e0c64df5a015f39a52d38d14 /Doc/library/http.client.rst
parent63a6a6fd41da648c9e79a2e347c151e1957d74e9 (diff)
parentac87ed7e9f0239b78459197cee3ddb1d2e77bc58 (diff)
downloadcpython-b174b85c1a37ee7452d26d041c30519425e4d421.zip
cpython-b174b85c1a37ee7452d26d041c30519425e4d421.tar.gz
cpython-b174b85c1a37ee7452d26d041c30519425e4d421.tar.bz2
merge 3.4 (#24118)
Diffstat (limited to 'Doc/library/http.client.rst')
-rw-r--r--Doc/library/http.client.rst12
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst
index 7d160ce..d57649c 100644
--- a/Doc/library/http.client.rst
+++ b/Doc/library/http.client.rst
@@ -427,18 +427,18 @@ Examples
Here is an example session that uses the ``GET`` method::
>>> import http.client
- >>> conn = http.client.HTTPConnection("www.python.org")
- >>> conn.request("GET", "/index.html")
+ >>> conn = http.client.HTTPSConnection("www.python.org")
+ >>> conn.request("GET", "/")
>>> r1 = conn.getresponse()
>>> print(r1.status, r1.reason)
200 OK
>>> data1 = r1.read() # This will return entire content.
>>> # The following example demonstrates reading data in chunks.
- >>> conn.request("GET", "/index.html")
+ >>> conn.request("GET", "/")
>>> r1 = conn.getresponse()
>>> while not r1.closed:
... print(r1.read(200)) # 200 bytes
- b'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
+ b'<!doctype html>\n<!--[if"...
...
>>> # Example of an invalid request
>>> conn.request("GET", "/parrot.spam")
@@ -452,8 +452,8 @@ Here is an example session that uses the ``HEAD`` method. Note that the
``HEAD`` method never returns any data. ::
>>> import http.client
- >>> conn = http.client.HTTPConnection("www.python.org")
- >>> conn.request("HEAD","/index.html")
+ >>> conn = http.client.HTTPSConnection("www.python.org")
+ >>> conn.request("HEAD", "/")
>>> res = conn.getresponse()
>>> print(res.status, res.reason)
200 OK