From 62cf6981425c6a6b136c5e2abef853364f535e9d Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Wed, 11 Sep 2019 05:41:54 -0700 Subject: [PATCH] bpo-35649: update http client example (GH-11441) --- Doc/library/http.client.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst index 4e761cd39a0..48bc35ca76c 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'\n