tkrajina / srtm.py

Geo elevation data parser for "The Shuttle Radar Topography Mission" data
Apache License 2.0
240 stars 57 forks source link

SRTM endpoint timeout #45

Open jtpio opened 4 years ago

jtpio commented 4 years ago

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)
tkrajina commented 4 years ago

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.

jtpio commented 4 years ago

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

tkrajina commented 4 years ago

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.