summaryrefslogtreecommitdiffstats
path: root/Doc/library/urllib.request.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-06-23 11:44:14 (GMT)
committerGeorg Brandl <georg@python.org>2008-06-23 11:44:14 (GMT)
commit029986af249f71a5603110a0f5f0b18d0f335828 (patch)
tree90fafdd902e370d05952d900b7270043ad4c0053 /Doc/library/urllib.request.rst
parent0f7ede45693be57ba51c7aa23a0d841f160de874 (diff)
downloadcpython-029986af249f71a5603110a0f5f0b18d0f335828.zip
cpython-029986af249f71a5603110a0f5f0b18d0f335828.tar.gz
cpython-029986af249f71a5603110a0f5f0b18d0f335828.tar.bz2
Fix old urllib/urllib2/urlparse usage.
Diffstat (limited to 'Doc/library/urllib.request.rst')
-rw-r--r--Doc/library/urllib.request.rst4
1 files changed, 2 insertions, 2 deletions
diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst
index d124d9a..c506829 100644
--- a/Doc/library/urllib.request.rst
+++ b/Doc/library/urllib.request.rst
@@ -1077,7 +1077,7 @@ Adding HTTP headers:
Use the *headers* argument to the :class:`Request` constructor, or::
- import urllib
+ import urllib.request
req = urllib.request.Request('http://www.example.com/')
req.add_header('Referer', 'http://www.python.org/')
r = urllib.request.urlopen(req)
@@ -1085,7 +1085,7 @@ Use the *headers* argument to the :class:`Request` constructor, or::
:class:`OpenerDirector` automatically adds a :mailheader:`User-Agent` header to
every :class:`Request`. To change this::
- import urllib
+ import urllib.request
opener = urllib.request.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
opener.open('http://www.example.com/')