srtm.py icon indicating copy to clipboard operation
srtm.py copied to clipboard

SRTM endpoint timeout

Open jtpio opened this issue 6 years ago • 3 comments

It looks like the SRTM endpoints are down or not reachable anymore:

http://dds.cr.usgs.gov/srtm/version2_1/SRTM1/

Getting the following error:

/srv/conda/envs/notebook/lib/python3.7/site-packages/srtm/data.py in retrieve_or_load_file_data(self, file_name)
    143             r = mod_requests.get(url, timeout=5)
    144         except mod_requests.exceptions.Timeout:
--> 145             raise Exception('Connection to %s failed (timeout)' % url)
    146         if r.status_code < 200 or 300 <= r.status_code:
    147             raise Exception('Cannot retrieve %s' % url)

Exception: Connection to http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/Eurasia/N42E011.hgt.zip failed (timeout)

jtpio avatar Sep 30 '19 08:09 jtpio

It's working now. But, I'm aware (and everybody else should be) that this can happen any time. Unfortunately there is no simple solution.

tkrajina avatar Sep 30 '19 15:09 tkrajina

The links seem to be back, but I'm still seeing the issue when using strm.py.

Could it be that the timeout is a little bit tight? (5 seconds):

https://github.com/tkrajina/srtm.py/blob/37fb8a6f52c8ca25565772e59e867ac26181f829/srtm/data.py#L143

jtpio avatar Sep 30 '19 18:09 jtpio

Hm, try to increase it and see ifit works. If you want to make a pull request to make the timeout configurable (with 5s default fallback), I can merge it.

tkrajina avatar Sep 30 '19 18:09 tkrajina