easysnowdata.providers.earthdata.download_with_password#

easysnowdata.providers.earthdata.download_with_password(url: str, subdir: str, *, valid: Callable[[Path], bool] | None = None, timeout: float = 120) → Path[source]#

Download one file from a server that refuses a bearer token.

NSIDC’s on-premises daacdata tree answers a token-only request with the URS login page and HTTP 200, which earthaccess.download saves as if it were the file. This goes through password_session() instead, so the username and password are used even when EARTHDATA_TOKEN is also set.

The file lands in <cache>/<subdir> and is reused on the next call. A cached file that fails valid, such as a login page an older version saved, is fetched again. A 404 raises FileNotFoundError; a download that ends on URS, or that fails valid, raises instead of being cached.