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
ca90ca81
Commit
ca90ca81
authored
Mar 05, 2007
by
Facundo Batista
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor corrections to docs, and an explanation comentary
parent
391e27d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
+14
-13
Lib/urllib2.py
Lib/urllib2.py
+14
-13
No files found.
Lib/urllib2.py
View file @
ca90ca81
...
...
@@ -14,36 +14,36 @@ non-error returns. The HTTPRedirectHandler automatically deals with
HTTP 301, 302, 303 and 307 redirect errors, and the HTTPDigestAuthHandler
deals with digest authentication.
urlopen(url, data=None) --
b
asic usage is the same as original
urlopen(url, data=None) --
B
asic usage is the same as original
urllib. pass the url and optionally data to post to an HTTP URL, and
get a file-like object back. One difference is that you can also pass
a Request instance instead of URL. Raises a URLError (subclass of
IOError); for HTTP errors, raises an HTTPError, which can also be
treated as a valid response.
build_opener --
f
unction that creates a new OpenerDirector instance.
will install the default handlers. a
ccepts one or more Handlers as
build_opener --
F
unction that creates a new OpenerDirector instance.
Will install the default handlers. A
ccepts one or more Handlers as
arguments, either instances or Handler classes that it will
instantiate.
i
f one of the argument is a subclass of the default
instantiate.
I
f one of the argument is a subclass of the default
handler, the argument will be installed instead of the default.
install_opener --
i
nstalls a new opener as the default opener.
install_opener --
I
nstalls a new opener as the default opener.
objects of interest:
OpenerDirector --
OpenerDirector --
Request --
an object that encapsulates the state of a request. t
he
state can be a
simple as the URL. i
t can also include extra HTTP
Request --
An object that encapsulates the state of a request. T
he
state can be a
s simple as the URL. I
t can also include extra HTTP
headers, e.g. a User-Agent.
BaseHandler --
exceptions:
URLError
-- a
subclass of IOError, individual protocols have their own
specific subclass
URLError
-- A
subclass of IOError, individual protocols have their own
specific subclass
.
HTTPError
-- a
lso a valid HTTP response, so you can treat an HTTP error
as an exceptional event or valid response
HTTPError
-- A
lso a valid HTTP response, so you can treat an HTTP error
as an exceptional event or valid response
.
internals:
BaseHandler and parent
...
...
@@ -334,7 +334,8 @@ class OpenerDirector:
added = True
if added:
# XXX why does self.handlers need to be sorted?
# the handlers must work in an specific order, the order
# is specified in a Handler attribute
bisect.insort(self.handlers, handler)
handler.add_parent(self)
...
...
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