[Python-checkins] cpython (merge 3.4 -> default): merge 3.4 (#24118)
benjamin.peterson
python-checkins at python.org
Sun May 3 19:00:43 CEST 2015
https://hg.python.org/cpython/rev/07571d2968b0
changeset: 95875:07571d2968b0
parent: 95872:bfea101f9402
parent: 95873:71ec881d8347
user: Benjamin Peterson <benjamin at python.org>
date: Sun May 03 13:00:37 2015 -0400
summary:
merge 3.4 (#24118)
files:
Doc/library/http.client.rst | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst
--- a/Doc/library/http.client.rst
+++ b/Doc/library/http.client.rst
@@ -427,18 +427,18 @@
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 @@
``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
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list