Finding Default Page Name using urllib2

Philip Semanchuk philip at semanchuk.com
Mon Oct 27 12:29:02 EDT 2008


On Oct 27, 2008, at 12:17 PM, barrett wrote:

> Is there a way to find the name of a page you are retrieving using
> python.  For example, if I get http://www.cnn.com/ 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?

Hi barrett,
Look into the urllib2 module and specifically HTTPRedirectHandler  
objects.


Good luck
Philip



More information about the Python-list mailing list