From efcf14c72bad2cb59d3ea543651e47b7f6f5987f Mon Sep 17 00:00:00 2001 From: Scott Staniewicz Date: Sun, 5 Nov 2023 20:50:14 -0500 Subject: [PATCH] add back in the auth login url for ASF This is the URL that you get redirected to due to a 302 response. You can see the flow with $ curl -v -L "https://s1qc.asf.alaska.edu/aux_poeorb/S1A_OPER_AUX_POEORB_OPOD_20231102T080652_V20231012T225942_20231014T005942.EOF" it was added previously, but was failing in my testing during the big switchover. It is possible we don't need this at all if that have an earthdata token, but i could not get that to work either. Will check with ASF people about that. --- eof/download.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eof/download.py b/eof/download.py index 20ecc1d..0147c1e 100644 --- a/eof/download.py +++ b/eof/download.py @@ -149,8 +149,12 @@ def _download_and_write(url, save_dir=".", asf_user="", asf_password=""): return [fname] logger.info("Downloading %s", url) + login_url = ( + "https://urs.earthdata.nasa.gov/oauth/authorize?response_type=code" + f"&client_id=BO_n7nTIlMljdvU6kRRB3g&redirect_uri=https://auth.asf.alaska.edu/login&state={url}" + ) # Add credentials - response = requests.get(url, auth=(asf_user, asf_password)) + response = requests.get(login_url, auth=(asf_user, asf_password)) response.raise_for_status() logger.info("Saving to %s", fname) with open(fname, "wb") as f: