Retrieve Custom 404 page.

G

godavemon

I'm using urllib2 to pull pages for a custom version of a web proxy
and am having issues with 404 errors. Urllib2 does a great job of
letting me know that a 404 happened with the following code.

import urllib2
url = 'http://cnn.com/asfsdafsadfasdf/'
try:
page = urllib2.urlopen( url )
except urllib2.URLError, e:
print e

returns: HTTP Error 404: Not Found


However, upon finding the error I would like to load the domain's
custom 404 message instead of returning my own. I've checked the
error information and searched for some sort of web standard but
cannot find anything.

Does anyone know if it is possible to retrieve a url or the page
information for the custom 404 page like this?

http://cnn.com/asdfasdfadsf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top