Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ce9b596c
Commit
ce9b596c
authored
Jun 19, 2011
by
Senthil Kumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix closes Issue12315 - Updates to http.client documentation.
parent
206cd1c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
Doc/library/http.client.rst
Doc/library/http.client.rst
+12
-1
No files found.
Doc/library/http.client.rst
View file @
ce9b596c
...
...
@@ -543,6 +543,9 @@ statement.
A debugging hook. If :attr:`debuglevel` is greater than zero, messages
will be printed to stdout as the response is read and parsed.
.. attribute:: HTTPResponse.closed
Is True if the stream is closed.
Examples
--------
...
...
@@ -555,7 +558,15 @@ Here is an example session that uses the ``GET`` method::
>>> r1 = conn.getresponse()
>>> print(r1.status, r1.reason)
200 OK
>>> data1 = r1.read()
>>> data1 = r1.read() # This will return entire content.
>>> # The following example demonstrates reading data in chunks.
>>> conn.request("GET", "/index.html")
>>> r1 = conn.getresponse()
>>> while not r1.closed:
... print(r1.read(200)) # 200 bytes
b'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
...
>>> # Example of an invalid request
>>> conn.request("GET", "/parrot.spam")
>>> r2 = conn.getresponse()
>>> print(r2.status, r2.reason)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment