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

This commit is contained in:
Ashwin Ramaswami 2019-09-11 05:41:54 -07:00 committed by Julien Palard
parent 1a13efb7e0
commit 62cf698142
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