Chuck Esterbrook wrote:
> Unless read() automatically handles the redirects...
Bingo. You can get around the automatic redirect by using the URLopener class:
def tryurl(url):
import urllib, pprint
try:
u = urllib.URLopener()
f = u.open(url)
pprint.pprint(f.headers.dict)
print f.read()
except IOError, info:
print 'Exception: ' + str(info)
pprint.pprint(info[3].dict)
>>> tryurl('http://inet/InstallCalendar')
('http error', 301, 'Moved Permanently', <mimetools.Message instance at 82be30>)
{'connection': 'close',
'content-type': 'text/html; charset=iso-8859-1',
'date': 'Fri, 23 Jun 2000 14:08:28 GMT',
'location': 'http://inet.nameconnector.com/InstallCalendar/',
'server': 'OpenSA/0.20 Apache/1.3.12 (Win32)'}
--
- Geoff Talvola
Parlance Corporation
gtalvola@...
|