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
c7e913b2
Commit
c7e913b2
authored
Mar 09, 2005
by
Skip Montanaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct description/example of how to override User-agent.
parent
adcabfd8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
Doc/lib/liburllib.tex
Doc/lib/liburllib.tex
+4
-4
No files found.
Doc/lib/liburllib.tex
View file @
c7e913b2
...
@@ -160,8 +160,8 @@ can be accomplished with the following code:
...
@@ -160,8 +160,8 @@ can be accomplished with the following code:
import urllib
import urllib
class AppURLopener(urllib.FancyURLopener):
class AppURLopener(urllib.FancyURLopener):
version = "App/1.7"
def
__
init
__
(self, *args):
def
__
init
__
(self, *args):
self.version = "App/1.7"
urllib.FancyURLopener.
__
init
__
(self, *args)
urllib.FancyURLopener.
__
init
__
(self, *args)
urllib.
_
urlopener = AppURLopener()
urllib.
_
urlopener = AppURLopener()
...
@@ -243,9 +243,9 @@ By default, the \class{URLopener} class sends a
...
@@ -243,9 +243,9 @@ By default, the \class{URLopener} class sends a
\mailheader
{
User-Agent
}
header of
\samp
{
urllib/
\var
{
VVV
}}
, where
\mailheader
{
User-Agent
}
header of
\samp
{
urllib/
\var
{
VVV
}}
, where
\var
{
VVV
}
is the
\module
{
urllib
}
version number. Applications can
\var
{
VVV
}
is the
\module
{
urllib
}
version number. Applications can
define their own
\mailheader
{
User-Agent
}
header by subclassing
define their own
\mailheader
{
User-Agent
}
header by subclassing
\class
{
URLopener
}
or
\class
{
FancyURLopener
}
and setting the
instance
\class
{
URLopener
}
or
\class
{
FancyURLopener
}
and setting the
class
attribute
\member
{
version
}
to an appropriate string value
before
the
attribute
\member
{
version
}
to an appropriate string value
in
the
\method
{
open()
}
method is called
.
subclass definition
.
The optional
\var
{
proxies
}
parameter should be a dictionary mapping
The optional
\var
{
proxies
}
parameter should be a dictionary mapping
scheme names to proxy URLs, where an empty dictionary turns proxies
scheme names to proxy URLs, where an empty dictionary turns proxies
...
...
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