[Tutor] URLs for urllib.urlopen

Simon Brunning SBrunning@trisystems.co.uk
Fri, 29 Jun 2001 14:42:39 +0100


Can someone explain this to me?

PythonWin 2.1 (#15, Apr 16 2001, 18:25:49) [MSC 32 bit (Intel)] on win32.
Portions Copyright 1994-2001 Mark Hammond (MarkH@ActiveState.com) - see
'Help/About PythonWin' for further copyright information.
>>> import urllib, pprint
>>> page = urllib.urlopen('http://www.python.org')
>>> data = page.readlines()
>>> pprint.pprint(data)
['<html><head><title>Error</title></head><body>The parameter is incorrect.
</body></html>']
>>> page = urllib.urlopen('http://www.python.org/')
>>> data = page.readlines()
>>> pprint.pprint(data)
['<HTML>\n',
 '<!-- THIS PAGE IS AUTOMATICALLY GENERATED.  DO NOT EDIT. -->\n',
(... snip)

It appears that urllib requires a trailing slash, but in the examples in the
effbot's PSL book, he doesn't give one. Any ideas?

Cheers,
Simon Brunning
TriSystems Ltd.
sbrunning@trisystems.co.uk





-----------------------------------------------------------------------
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
accept liability for statements made which are clearly the senders own.