summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2005-03-09 02:57:26 (GMT)
committerSkip Montanaro <skip@pobox.com>2005-03-09 02:57:26 (GMT)
commit8e97fbf360730bf1297c657cf41e6aa4143dd8c8 (patch)
tree80124aa157bde857618731e83402bbe0689df61b /Doc
parente2713becd8cb0c3b2db4d33832dd57a1d619f0f3 (diff)
downloadcpython-8e97fbf360730bf1297c657cf41e6aa4143dd8c8.zip
cpython-8e97fbf360730bf1297c657cf41e6aa4143dd8c8.tar.gz
cpython-8e97fbf360730bf1297c657cf41e6aa4143dd8c8.tar.bz2
Correct description/example of how to override User-agent.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/liburllib.tex8
1 files changed, 4 insertions, 4 deletions
diff --git a/Doc/lib/liburllib.tex b/Doc/lib/liburllib.tex
index b25c7a4..f9742a2 100644
--- a/Doc/lib/liburllib.tex
+++ b/Doc/lib/liburllib.tex
@@ -160,8 +160,8 @@ can be accomplished with the following code:
import urllib
class AppURLopener(urllib.FancyURLopener):
+ version = "App/1.7"
def __init__(self, *args):
- self.version = "App/1.7"
urllib.FancyURLopener.__init__(self, *args)
urllib._urlopener = AppURLopener()
@@ -243,9 +243,9 @@ By default, the \class{URLopener} class sends a
\mailheader{User-Agent} header of \samp{urllib/\var{VVV}}, where
\var{VVV} is the \module{urllib} version number. Applications can
define their own \mailheader{User-Agent} header by subclassing
-\class{URLopener} or \class{FancyURLopener} and setting the instance
-attribute \member{version} to an appropriate string value before the
-\method{open()} method is called.
+\class{URLopener} or \class{FancyURLopener} and setting the class
+attribute \member{version} to an appropriate string value in the
+subclass definition.
The optional \var{proxies} parameter should be a dictionary mapping
scheme names to proxy URLs, where an empty dictionary turns proxies