warn_transformer/download.py
def run(
    download_dir: Path = utils.WARN_TRANSFORMER_OUTPUT_DIR / "raw",
    source: typing.Optional[str] = None,
):
    """Download all the CSVs in the WARN Notice project on biglocalnews.org.

    Args:
        download_dir (Path): The directory where files will be downloaded.
        source (str): The postal code of the source to download. Default is all sources.
    """
    logging.basicConfig(level="DEBUG", format="%(asctime)s - %(name)s - %(message)s")

    # Login to BLN.
    c = Client(BLN_API_KEY)

    # Get the Warn Act Notices project.
    p = c.get_project_by_name("WARN Act Notices")

    # Get all the files in the project.
    file_list = [f["name"] for f in p["files"]]

    # If a source is provided, limit the list
    if source:
        file_list = [f for f in file_list if source.lower() in f.lower()]

    # Make the download directory, if it doesn't already exist.
    if not download_dir.exists():
        download_dir.mkdir(parents=True)

    # Download all the files.
    for f in file_list:
        logger.debug(f"Download {f} to {download_dir}")
        c.download_file(BLN_PROJECT_ID, f, output_dir=download_dir)
Download all the CSVs in the WARN Notice project on biglocalnews.org.

    Args:
        download_dir (Path): The directory where files will be downloaded.
        source (str): The postal code of the source to download. Default is all sources.
    
Download all the CSVs in the WARN Notice project on biglocalnews.org.
Download all the CSVs in the WARN Notice project on biglocalnews . org .
def run(
    download_dir: Path = utils.WARN_TRANSFORMER_OUTPUT_DIR / "raw",
    source: typing.Optional[str] = None,
):
    logging.basicConfig(level="DEBUG", format="%(asctime)s - %(name)s - %(message)s")
    c = Client(BLN_API_KEY)
    p = c.get_project_by_name("WARN Act Notices")
    file_list = [f["name"] for f in p["files"]]
    if source:
        file_list = [f for f in file_list if source.lower() in f.lower()]
    if not download_dir.exists():
        download_dir.mkdir(parents=True)
    for f in file_list:
        logger.debug(f"Download {f} to {download_dir}")
        c.download_file(BLN_PROJECT_ID, f, output_dir=download_dir)
def run ( download_dir : Path = utils . WARN_TRANSFORMER_OUTPUT_DIR / "raw" , source : typing . Optional [ str ] = None , ) : logging . basicConfig ( level = "DEBUG" , format = "%(asctime)s - %(name)s - %(message)s" ) c = Client ( BLN_API_KEY ) p = c . get_project_by_name ( "WARN Act Notices" ) file_list = [ f [ "name" ] for f in p [ "files" ] ] if source : file_list = [ f for f in file_list if source . lower ( ) in f . lower ( ) ] if not download_dir . exists ( ) : download_dir . mkdir ( parents = True ) for f in file_list : logger . debug ( f"Download {f} to {download_dir}" ) c . download_file ( BLN_PROJECT_ID , f , output_dir = download_dir )
Download all the CSVs in the WARN Notice project on biglocalnews.org.
Download all the CSVs in the WARN Notice project on biglocalnews . org .
"""Download all the CSVs in the WARN Notice project on biglocalnews.org.

    Args:
        download_dir (Path): The directory where files will be downloaded.
        source (str): The postal code of the source to download. Default is all sources.
    """ # Login to BLN. # Get the Warn Act Notices project. # Get all the files in the project. # If a source is provided, limit the list # Make the download directory, if it doesn't already exist. # Download all the files.
download_dir
Path
The directory where files will be downloaded.
The directory where files will be downloaded .
source
typing.Optional[str]
The postal code of the source to download. Default is all sources.
The postal code of the source to download . Default is all sources .