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.
|
>>> # The following example demonstrates reading data in chunks.
|
||||||
>>> conn.request("GET", "/")
|
>>> conn.request("GET", "/")
|
||||||
>>> r1 = conn.getresponse()
|
>>> r1 = conn.getresponse()
|
||||||
>>> while not r1.closed:
|
>>> while True:
|
||||||
... print(r1.read(200)) # 200 bytes
|
... chunk = r1.read(200) # 200 bytes
|
||||||
|
... if not chunk:
|
||||||
|
... break
|
||||||
|
... print(repr(chunk))
|
||||||
b'<!doctype html>\n<!--[if"...
|
b'<!doctype html>\n<!--[if"...
|
||||||
...
|
...
|
||||||
>>> # Example of an invalid request
|
>>> # Example of an invalid request
|
||||||
|
|
Loading…
Reference in New Issue