示例#1
0
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)
示例#2
0
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)
示例#3
0
文件: add.py 项目: pombredanne/skid
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