Finding Default Page Name using urllib2

barrett stephen.p.barrett at
Mon Oct 27 17:17:04 CET 2008

Is there a way to find the name of a page you are retrieving using
python.  For example, if I get i want to know that
the page is index.html.  I can do this using wget. as seen in the code
below.  Can I do this in python?


$ wget
           => `index.html'
Resolving,,, ...
Connecting to||:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: [following]
           => `index.html'
Resolving,,, ...
Reusing existing connection to
HTTP request sent, awaiting response... 200 OK
Length: 96,094 (94K) [text/html]

100%[====================================>] 96,094        68.15K/s

11:15:28 (67.99 KB/s) - `index.html' saved [96094/96094]

More information about the Python-list mailing list