Downloader helper

class jsonstat.Downloader(cache_dir=u'./data', time_to_live=None)[source]

Helper class to download json stat files.

It has a very simple cache mechanism

cache_dir()[source]
download(url, filename=None, time_to_live=None)[source]

Download url from internet.

Store the downloaded content into <cache_dir>/file. If <cache_dir>/file exists, it returns content from disk

Parameters:
  • url – page to be downloaded
  • filename – filename where to store the content of url, None if we want not store
  • time_to_live – how many seconds to store file on disk, None use default time_to_live, 0 don’t use cached version if any
Returns:

the content of url (str type)