landsatxplore
landsatxplore copied to clipboard
Download does not seem to work
landsatxplore download -u $username -p $password LC09_L1TP_035038_20220707_20220707_02_T1
It looks like the login is not working when downloading but works fine when searching.
Traceback (most recent call last):
File "/opt/miniconda3/envs/retriever3.8/bin/landsatxplore", line 8, in <module>
sys.exit(cli())
File "/opt/miniconda3/envs/retriever3.8/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/opt/miniconda3/envs/retriever3.8/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/opt/miniconda3/envs/retriever3.8/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/miniconda3/envs/retriever3.8/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/miniconda3/envs/retriever3.8/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/opt/miniconda3/envs/retriever3.8/lib/python3.8/site-packages/landsatxplore/cli.py", line 157, in download
ee = EarthExplorer(username, password)
File "/opt/miniconda3/envs/retriever3.8/lib/python3.8/site-packages/landsatxplore/earthexplorer.py", line 55, in __init__
self.login(username, password)
File "/opt/miniconda3/envs/retriever3.8/lib/python3.8/site-packages/landsatxplore/earthexplorer.py", line 66, in login
csrf, ncform = _get_tokens(rsp.text)
File "/opt/miniconda3/envs/retriever3.8/lib/python3.8/site-packages/landsatxplore/earthexplorer.py", line 39, in _get_tokens
ncform = re.findall(r'name="__ncforminfo" value="(.+?)"', body)[0]
IndexError: list index out of range
Also I have just noticed this,
There is a scheduled system outage for Thursday, July 14, 2022, from 6:00 PM CDT to 8:00 PM CDT. Downloads may be intermittent during this time.
from the website https://earthexplorer.usgs.gov
Same issue here! Any chance they changed something during the system maintenance?
I believe so. They always change the platform, and it always results in backwards compatibility issues. This is true for the API they provide,
the usgs-machine-to-machine-API
, which now fails with the same error.
INPUT_PARAMETER_INVALID - Scene list does not contain any valid scenes
An update on this: there are some changes on the scene list at https://earthexplorer.usgs.gov/order/index/. You need to sign in. It looks like you will need to order them from the website. The Machine-to-Machine (M2M) API doesn't seem updated. Hope it's not more manual work than it is currently.
hi,Did you solve the problem?
hi,Did you solve the problem?
Not yet solved
This is a crucial problem that makes this beautiful tool literally unusable. Any suggestion by the developer @yannforget?
I have the same problem.
I think just remove ncform in function get_token, it will work.
def _get_tokens(body): """Get
csrf_tokenand
__ncforminfo.""" csrf = re.findall(r'name="csrf" value="(.+?)"', body)[0] ncform = re.findall(r'name="__ncforminfo" value="(.+?)"', body)[0]
I think just remove ncform in function get_token, it will work.
def _get_tokens(body): """Get
csrf_tokenand
__ncforminfo.""" csrf = re.findall(r'name="csrf" value="(.+?)"', body)[0] ncform = re.findall(r'name="__ncforminfo" value="(.+?)"', body)[0]
yes it works!
just change function _get_tokens to:
def _get_tokens(body):
"""Get `csrf_token` and `__ncforminfo`."""
csrf = re.findall(r'name="csrf" value="(.+?)"', body)[0]
# ncform = re.findall(r'name="__ncforminfo" value="(.+?)"', body)[0]
if not csrf:
raise EarthExplorerError("EE: login failed (csrf token not found).")
# if not ncform:
# raise EarthExplorerError("EE: login failed (ncforminfo not found).")
ncform = None
return csrf, ncform
now I am able to download successfully.
but why is this?
Hi, I encountered the same issue today. It seems this issue is fixed by @jcintasr PR https://github.com/yannforget/landsatxplore/pull/75.