469,643 Members | 1,486 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,643 developers. It's quick & easy.

Retrieve Custom 404 page.

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
Nov 17 '08 #1
0 1038

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Scott Zabolotzky | last post: by
reply views Thread by Georg | last post: by
1 post views Thread by Albert Hopkins | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.