Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _download_file(self, path, url, tile_fmt, filename, check_modified=False):
os.makedirs(path, exist_ok=True)
os.makedirs(os.path.join(path, 'zip'), exist_ok=True)
tile_path = os.path.join(path, filename)
util.logger.info('... downloading %s' % url)
if tile_fmt == '':
ulmo.util.download_if_new(url, tile_path, check_modified=check_modified)
else:
zip_path = os.path.join(path, 'zip', filename)
ulmo.util.download_if_new(url, zip_path, check_modified=check_modified)
util.logger.info('... ... zipfile saved at %s' % zip_path)
tile_path = ulmo.util.extract_from_zip(zip_path, tile_path, tile_fmt)
return tile_path