diff options
author | Ashwin Ramaswami <aramaswamis@gmail.com> | 2019-09-11 12:41:54 (GMT) |
---|---|---|
committer | Julien Palard <julien@palard.fr> | 2019-09-11 12:41:54 (GMT) |
commit | 62cf6981425c6a6b136c5e2abef853364f535e9d (patch) | |
tree | 51174adf48f715df2524de41201a76f37bfc4be5 /Doc/library/http.client.rst | |
parent | 1a13efb7e05b545def26f29c954751fdb6b22fa3 (diff) | |
download | cpython-62cf6981425c6a6b136c5e2abef853364f535e9d.zip cpython-62cf6981425c6a6b136c5e2abef853364f535e9d.tar.gz cpython-62cf6981425c6a6b136c5e2abef853364f535e9d.tar.bz2 |
bpo-35649: update http client example (GH-11441)
Diffstat (limited to 'Doc/library/http.client.rst')
-rw-r--r-- | Doc/library/http.client.rst | 7 |
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 |