Small help for etag handler

master
pictuga 2013-07-19 00:02:52 +02:00
parent 90efb84c57
commit 1ba22516fe
1 changed files with 5 additions and 0 deletions

View File

@ -238,6 +238,11 @@ class HTMLDownloader(urllib2.HTTPCookieProcessor):
https_request = http_request
class CacheDownload(urllib2.BaseHandler):
"""
Custom urllib2 handler to download a page, using etag/last-modified headers,
to save bandwidth. The given headers are added back into the header on error
304 for easier use.
"""
def __init__(self, cache="", etag=None, lastmodified=None, useragent=UA_RSS):
self.cache = cache
self.etag = etag