How to use the pooch.HTTPDownloader function in pooch

To help you get started, we’ve selected a few pooch 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 icepack / icepack / icepack / datasets.py View on Github external
def fetch_larsen_outline():
    return larsen_outline.fetch(
        'larsen.geojson', downloader=pooch.HTTPDownloader(progressbar=True)
    )
github icepack / icepack / icepack / datasets.py View on Github external
def _earthdata_downloader(url, output_file, dataset):
    username = os.environ.get('EARTHDATA_USERNAME')
    if username is None:
        username = input('EarthData username: ')

    password = os.environ.get('EARTHDATA_PASSWORD')
    if password is None:
        password = getpass('EarthData password: ')
    auth = (username, password)

    login = requests.get(url)
    downloader = pooch.HTTPDownloader(auth=auth, progressbar=True)
    try:
        downloader(login.url, output_file, dataset)
    except requests.exceptions.HTTPError as error:
        if 'Unauthorized' in str(error):
            pooch.get_logger().error('Wrong username/password!')
        raise error
github icepack / icepack / icepack / datasets.py View on Github external
def fetch_bedmap2():
    downloader = pooch.HTTPDownloader(progressbar=True)
    filenames = bedmap2.fetch(
        'bedmap2_tiff.zip', processor=pooch.Unzip(), downloader=downloader
    )
    return [f for f in filenames if os.path.splitext(f)[1] == '.tif']