Redirect Caching Infrastructure (tendril.utils.www.redirectcaching)

TODO Some introduction


Called during python interpreter shutdown, this function dumps the redirect cache to the file system.

class tendril.utils.www.redirectcache.CachingRedirectHandler[source]

Bases: urllib.request.HTTPRedirectHandler

This handler modifies the behavior of urllib2.HTTPRedirectHandler, resulting in a HTTP 301 or 302 status to be included in the result.

When this handler is attached to a urllib2 opener, if the opening of the URL resulted in a redirect via HTTP 301 or 302, this is reported along with the result. This information can be used by the opener to maintain a redirect cache.

http_error_301(req, fp, code, msg, headers)[source]

Wraps the urllib2.HTTPRedirectHandler.http_error_301() handler, setting the result.status to 301 in case a http 301 error is encountered.

http_error_302(req, fp, code, msg, headers)[source]

Wraps the urllib2.HTTPRedirectHandler.http_error_302() handler, setting the result.status to 302 in case a http 302 error is encountered.