bpo-35649: update http client example (GH-11441) (GH-15930)

(cherry picked from commit 62cf698142)

Co-authored-by: Ashwin Ramaswami <aramaswamis@gmail.com>
This commit is contained in:
Miss Islington (bot) 2019-09-11 06:02:25 -07:00 committed by Julien Palard
parent 3b92ddb761
commit 43fb3bb223
1 changed files with 5 additions and 2 deletions

View File

@ -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