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:
parent
3b92ddb761
commit
43fb3bb223
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue