kapadia / usgs

Client library for interfacing with USGS datasets
http://kapadia.github.io/usgs/
ISC License
110 stars 38 forks source link

download_request fails with ConnectionError #57

Closed sbrunato closed 3 years ago

sbrunato commented 3 years ago

Hello, I am trying to download a product but download_request() hangs then fails:

>>> import usgs
>>> from usgs import api
>>> usgs.__version__
'0.3.0'
>>> api.login("login", "password,", save=True)
>>> download_options = api.download_options('LANDSAT_8_C1', 'LC80612142021055LGN00')
>>> product_ids = [ p["id"] for p in download_options["data"] if p["downloadSystem"] == "dds" ]
>>> download_request = api.download_request('LANDSAT_8_C1', 'LC80612142021055LGN00', product_ids[0])

Traceback (most recent call last):
  File "/home/sylvain/.virtualenvs/eodag-dev/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/home/sylvain/.virtualenvs/eodag-dev/lib/python3.8/site-packages/urllib3/connectionpool.py", line 426, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/home/sylvain/.virtualenvs/eodag-dev/lib/python3.8/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.8/http/client.py", line 1347, in getresponse
    response.begin()
  File "/usr/lib/python3.8/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.8/http/client.py", line 276, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sylvain/.virtualenvs/eodag-dev/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/home/sylvain/.virtualenvs/eodag-dev/lib/python3.8/site-packages/urllib3/connectionpool.py", line 726, in urlopen
    retries = retries.increment(
  File "/home/sylvain/.virtualenvs/eodag-dev/lib/python3.8/site-packages/urllib3/util/retry.py", line 410, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/home/sylvain/.virtualenvs/eodag-dev/lib/python3.8/site-packages/urllib3/packages/six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "/home/sylvain/.virtualenvs/eodag-dev/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/home/sylvain/.virtualenvs/eodag-dev/lib/python3.8/site-packages/urllib3/connectionpool.py", line 426, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/home/sylvain/.virtualenvs/eodag-dev/lib/python3.8/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.8/http/client.py", line 1347, in getresponse
    response.begin()
  File "/usr/lib/python3.8/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.8/http/client.py", line 276, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

Maybe there is an issue on USGS M2M API side ?

kapadia commented 3 years ago

@sbrunato were you able to sort this out? Though the documentation is outdated, there is a note about machine to machine permissions required to access the API:

https://kapadia.github.io/usgs/

sbrunato commented 3 years ago

@kapadia the api works fine again, thanks. It seemed to be that the service must have been temporally unavailable.

Do you know if USGS communicates when such events occur or if some maintenance is planned ? (web page, social media or rss feed, ...)

kapadia commented 3 years ago

Usually they communicate about upcoming maintenance periods on https://earthexplorer.usgs.gov/. Occasionally an email is sent as well. I haven't seen anything like an RSS feed.