How to use the gdown.download.download function in gdown

To help you get started, we’ve selected a few gdown examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wkentaro / gdown / tests / test_download.py View on Github external
def test_download():
    url = "https://raw.githubusercontent.com/wkentaro/gdown/3.1.0/gdown/__init__.py"  # NOQA
    output = "/tmp/gdown_r"

    # Usage before https://github.com/wkentaro/gdown/pull/32
    assert download(url, output, quiet=False) == output
    os.remove(output)
github wkentaro / gdown / gdown / cli.py View on Github external
)

    args = parser.parse_args()

    if args.output == "-":
        if six.PY3:
            args.output = sys.stdout.buffer
        else:
            args.output = sys.stdout

    if args.id:
        url = "https://drive.google.com/uc?id={id}".format(id=args.url_or_id)
    else:
        url = args.url_or_id

    download(
        url=url,
        output=args.output,
        quiet=args.quiet,
        proxy=args.proxy,
        speed=args.speed,
        use_cookies=not args.no_cookies,
    )
github wkentaro / gdown / gdown / cached_download.py View on Github external
os.makedirs(osp.dirname(path))
    except OSError:
        pass
    temp_root = tempfile.mkdtemp(dir=cache_root)
    try:
        temp_path = osp.join(temp_root, "dl")

        if not quiet:
            msg = "Cached Downloading"
            if path:
                msg = "{}: {}".format(msg, path)
            else:
                msg = "{}...".format(msg)
            print(msg, file=sys.stderr)

        download(url, temp_path, quiet=quiet, proxy=proxy, speed=speed)
        with filelock.FileLock(lock_path):
            shutil.move(temp_path, path)
    except Exception:
        shutil.rmtree(temp_root)
        raise

    if md5:
        assert_md5sum(path, md5, quiet=quiet)

    # postprocess
    if postprocess is not None:
        postprocess(path)

    return path

gdown

Google Drive Public File/Folder Downloader

MIT
Latest version published 6 months ago

Package Health Score

80 / 100
Full package analysis