def cache_url(url, dest): """ Download url, write contents to file. Return filename of contents, None on failure to download. """ # TODO: we should tell download where to store stuff explicitly... right now # we just both have the same convention. if not download(url, timeout=60, usecache=False, cached=dest): raise SkidDownloadError(url)
def cache_url(url): """ Download url, write contents to file. Return filename of contents, None on failure to download. """ cached = CACHE / secure_filename(url) assert not cached.exists(), 'File %s already exists.' % cached # TODO: we should tell download where to store stuff explicitly... right now # we just both have the same convention. if not download(url, timeout=60, usecache=False, cached=cached): raise Exception('Failed to download %s.' % url) return cached