mirror of https://github.com/python/cpython
bpo-35649: update http client example (GH-11441)
This commit is contained in:
parent
1a13efb7e0
commit
62cf698142
|
@ -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