Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download does not seem to work #82

Open
henrykironde opened this issue Jul 14, 2022 · 12 comments
Open

Download does not seem to work #82

henrykironde opened this issue Jul 14, 2022 · 12 comments

Comments

@henrykironde
Copy link

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
@henrykironde
Copy link
Author

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

@jeronimoluza
Copy link

Same issue here! Any chance they changed something during the system maintenance?

@henrykironde
Copy link
Author

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

@henrykironde
Copy link
Author

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.

@qk1997
Copy link

qk1997 commented Aug 15, 2022

hi,Did you solve the problem?

1 similar comment
@ghost
Copy link

ghost commented Aug 17, 2022

hi,Did you solve the problem?

@henrykironde
Copy link
Author

Not yet solved

@ahsouri
Copy link

ahsouri commented Sep 13, 2022

This is a crucial problem that makes this beautiful tool literally unusable. Any suggestion by the developer @yannforget?

@legendjslc
Copy link

I have the same problem.

@legendjslc
Copy link

I think just remove ncform in function get_token, it will work.
def _get_tokens(body): """Getcsrf_tokenand__ncforminfo.""" csrf = re.findall(r'name="csrf" value="(.+?)"', body)[0] ncform = re.findall(r'name="__ncforminfo" value="(.+?)"', body)[0]

@haozhen315
Copy link

haozhen315 commented Nov 4, 2022

I think just remove ncform in function get_token, it will work. def _get_tokens(body): """Getcsrf_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?

@tvoirand
Copy link

Hi,
I encountered the same issue today.
It seems this issue is fixed by @jcintasr PR #75.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants