async def load_json_or_yaml_from_url(context, url, path, overwrite=True):
    """Retry a json/yaml file download, load it, then return its data.

    Args:
        context (scriptworker.context.Context): the scriptworker context.
        url (str): the url to download
        path (str): the path to download to
        overwrite (bool, optional): if False and path exists, don't download.
            Defaults to True.

    Returns:
        dict: the url data.

    Raises:
        Exception: as specified, on failure

    """
    if path.endswith("json"):
        file_type = 'json'
    else:
        file_type = 'yaml'
    if not overwrite or not os.path.exists(path):
        await retry_async(
            download_file, args=(context, url, path),
            retry_exceptions=(DownloadError, aiohttp.ClientError),
        )
    return load_json_or_yaml(path, is_path=True, file_type=file_type)
async def load_json_or_yaml_from_url ( context , url , path , overwrite = True ) : if path . endswith ( "json" ) : file_type = 'json' else : file_type = 'yaml' if not overwrite or not os . path . exists ( path ) : await retry_async ( download_file , args = ( context , url , path ) , retry_exceptions = ( DownloadError , aiohttp . ClientError ) , ) return load_json_or_yaml ( path , is_path = True , file_type = file_type )
Retry a json/yaml file download, load it, then return its data.

    Args:
        context (scriptworker.context.Context): the scriptworker context.
        url (str): the url to download
        path (str): the path to download to
        overwrite (bool, optional): if False and path exists, don't download.
            Defaults to True.

    Returns:
        dict: the url data.

    Raises:
        Exception: as specified, on failure