Exemplo n.º 1
0
def deep_download(config: Union[str, Path, dict]) -> None:
    downloads = get_configs_downloads(config)

    for url, dest_paths in downloads.items():
        if not isinstance(config, dict):
            url = set_query_parameter(url, 'config', Path(config).stem)
        download_resource(url, dest_paths)
Exemplo n.º 2
0
def deep_download(config: Union[str, Path, dict]) -> None:
    downloads = get_configs_downloads(config)
    last_id = len(downloads) - 1
    session_id = secrets.token_urlsafe(32)

    for file_id, (url, dest_paths) in enumerate(downloads.items()):
        headers = {
            'dp-token': get_download_token(),
            'dp-session': session_id,
            'dp-file-id': str(last_id - file_id),
            'dp-version': deeppavlov.__version__
        }
        if not url.startswith('s3://') and not isinstance(config, dict):
            url = set_query_parameter(url, 'config', Path(config).stem)
        download_resource(url, dest_paths, headers)