[Python-checkins] bpo-35649: update http client example (GH-11441)
Julien Palard
webhook-mailer at python.org
Wed Sep 11 08:41:57 EDT 2019
https://github.com/python/cpython/commit/62cf6981425c6a6b136c5e2abef853364f535e9d
commit: 62cf6981425c6a6b136c5e2abef853364f535e9d
branch: master
author: Ashwin Ramaswami <aramaswamis at gmail.com>
committer: Julien Palard <julien at palard.fr>
date: 2019-09-11T14:41:54+02:00
summary:
bpo-35649: update http client example (GH-11441)
files:
M Doc/library/http.client.rst
diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst
index 4e761cd39a01..48bc35ca76cc 100644
--- a/Doc/library/http.client.rst
+++ b/Doc/library/http.client.rst
@@ -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
More information about the Python-checkins
mailing list