From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 11 Sep 2019 13:13:55 +0000 (-0700) Subject: bpo-35649: update http client example (GH-11441) (GH-15931) X-Git-Tag: v3.7.5rc1~85 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0fd8c0560b2099d2c976b17cf01cb596badc1ec6;p=thirdparty%2FPython%2Fcpython.git bpo-35649: update http client example (GH-11441) (GH-15931) (cherry picked from commit 62cf6981425c6a6b136c5e2abef853364f535e9d) Co-authored-by: Ashwin Ramaswami --- diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst index 3ebeb10aee9a..bc73c7a9bdf7 100644 --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -497,8 +497,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