summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshwin Ramaswami <aramaswamis@gmail.com>2019-09-11 12:41:54 (GMT)
committerJulien Palard <julien@palard.fr>2019-09-11 12:41:54 (GMT)
commit62cf6981425c6a6b136c5e2abef853364f535e9d (patch)
tree51174adf48f715df2524de41201a76f37bfc4be5
parent1a13efb7e05b545def26f29c954751fdb6b22fa3 (diff)
downloadcpython-62cf6981425c6a6b136c5e2abef853364f535e9d.zip
cpython-62cf6981425c6a6b136c5e2abef853364f535e9d.tar.gz
cpython-62cf6981425c6a6b136c5e2abef853364f535e9d.tar.bz2
bpo-35649: update http client example (GH-11441)
-rw-r--r--Doc/library/http.client.rst7
1 files changed, 5 insertions, 2 deletions
diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst
index 4e761cd..48bc35c 100644
--- a/Doc/library/http.client.rst
+++ b/Doc/library/http.client.rst
@@ -516,8 +516,11 @@ Here is an example session that uses the ``GET`` method::
>>> # The following example demonstrates reading data in chunks.
>>> conn.request("GET", "/")
>>> r1 = conn.getresponse()
- >>> while not r1.closed:
- ... print(r1.read(200)) # 200 bytes
+ >>> while True:
+ ... chunk = r1.read(200) # 200 bytes
+ ... if not chunk:
+ ... break
+ ... print(repr(chunk))
b'<!doctype html>\n<!--[if"...
...
>>> # Example of an invalid request