Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def fetch_larsen_outline():
return larsen_outline.fetch(
'larsen.geojson', downloader=pooch.HTTPDownloader(progressbar=True)
)
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
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']