summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-05-03 16:59:09 (GMT)
committerBenjamin Peterson <benjamin@python.org>2015-05-03 16:59:09 (GMT)
commitac87ed7e9f0239b78459197cee3ddb1d2e77bc58 (patch)
treeebcea1691b4a44138338c3a89685aedea01c03ef /Doc
parent8c59816b70a30d8ec2ff4e60a8b4a747f8ff75db (diff)
downloadcpython-ac87ed7e9f0239b78459197cee3ddb1d2e77bc58.zip
cpython-ac87ed7e9f0239b78459197cee3ddb1d2e77bc58.tar.gz
cpython-ac87ed7e9f0239b78459197cee3ddb1d2e77bc58.tar.bz2
update example, since python.org is HTTPS-only now (closes #24118)
Diffstat (limited to 'Doc')
-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 6324305..807f685 100644
--- a/Doc/library/http.client.rst
+++ b/Doc/library/http.client.rst
@@ -615,18 +615,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")
@@ -640,8 +640,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