landsatxplore
landsatxplore copied to clipboard
JSONDecodeError using API(username, password)
File "C:\Users\mas108\AppData\Local\Continuum\anaconda3\lib\site-packages\landsatxplore\earthexplorer.py", line 46, in init self.api = API(username, password)
File "C:\Users\mas108\AppData\Local\Continuum\anaconda3\lib\site-packages\landsatxplore\api.py", line 27, in init self.key = self.login(username, password)
File "C:\Users\mas108\AppData\Local\Continuum\anaconda3\lib\site-packages\landsatxplore\api.py", line 47, in login response = requests.post(self.endpoint + 'login?', data=data).json()
File "C:\Users\mas108\AppData\Local\Continuum\anaconda3\lib\site-packages\requests\models.py", line 900, in json return complexjson.loads(self.text, **kwargs)
File "C:\Users\mas108\AppData\Local\Continuum\anaconda3\lib\json_init_.py", line 348, in loads return _default_decoder.decode(s)
File "C:\Users\mas108\AppData\Local\Continuum\anaconda3\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\mas108\AppData\Local\Continuum\anaconda3\lib\json\decoder.py", line 356, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None
JSONDecodeError: Expecting value
Looks like the endpoints is down. https://earthexplorer.usgs.gov/inventory/json/v/1.4.1
Anyone know if this is temporary?
Same issue here:
File "l8_download_manager.py", line 142, in query_landsat_api api = landsatxplore.api.API(username, password) File "/pardees/f001/aradov/stream/venv_pardees/lib64/python3.6/site-packages/landsatxplore/api.py", line 28, in init self.key = self.login(username, password) File "/pardees/f001/aradov/stream/venv_pardees/lib64/python3.6/site-packages/landsatxplore/api.py", line 48, in login response = requests.post(self.endpoint + 'login?', data=data).json() File "/pardees/f001/aradov/stream/venv_pardees/lib64/python3.6/site-packages/requests/models.py", line 900, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib64/python3.6/json/init.py", line 354, in loads return _default_decoder.decode(s) File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I got this error when there was server maintenance so I got an error code 503 when I visited the EarthExplorer website.
Correct me if I'm wrong, I think this error happens when the server is down but api.py
will always assume the server is up and attempt to decode the URL content (which is nothing). So this raises a confusing error that doesn't make it obvious that it is a server related error. I don't see any check on HTTP return codes in api.py
.
My advice is to check the EarthExplorer site when you get this error or add a check yourself. I can do a PR if the author is still around @yannforget .
I was able to resolve this error by upgrading to the latest version (0.13.0) of this package. The issue was I was using Python 3.6.8 and couldn't get a version higher than 0.10.0 of this package. I updated to Python 3.9.x and landsatxplore 0.13.0 and don't see this error anymore.