Commit 16b80c1f authored by Niklas Keck's avatar Niklas Keck
Browse files

added 'timeout' argument

parent c08f4096
Pipeline #9884 failed with stages
in 27 minutes and 49 seconds
......@@ -81,7 +81,7 @@ class Gts2Request(dict):">>>>>> API-call: %s " % self.api_call)
# get data, update dict from json
result = requests.get(self.api_call, verify=False, auth=opts["auth"]["auth"])
result = requests.get(self.api_call, verify=False, auth=opts["auth"]["auth"], timeout=opts["timeout"])
status = {"http_code": result.status_code}
......@@ -714,7 +714,7 @@ def __get_auth(logger=None):
def client(outpath="", out_prefix="", out_mode="json", geo_ll=(), geo_ur=(), sensor="S2A", bands="", max_cloudy="0.5",
level="L2A", start_date="", end_date="", version="0.13", suffix="", minimum_fill="",
only_tile="", stack_resolution="10", quiet=False, rgb_extension="jpg", rgb_bands_selection="realistic",
merge_tifs=False, merge_tile=None, onlytime=False):
merge_tifs=False, merge_tile=None, onlytime=False, timeout=None):
Downloads data via API and saves it in a wanted file format (.json, .tiff or .nc) or alternatively returns a python
......@@ -789,7 +789,7 @@ def client(outpath="", out_prefix="", out_mode="json", geo_ll=(), geo_ur=(), sen
opts = {"ll": geo_ll, "ur": geo_ur, "sensor": sensor, "bands": bands,
"max_cloudy": max_cloudy, "auth": auth, "level": level, "date_from": start_date, "date_to": end_date,
"version": version, "suffix": suffix, "minimum_fill": minimum_fill, "utm_zone": only_tile, "logger": logger,
"onlytime": onlytime}
"onlytime": onlytime, "timeout": timeout}
# actual API request"Requesting data from the GTS2 server ...", )
......@@ -919,6 +919,8 @@ if __name__ == "__main__":
help="Choose MGRS tile into which the merge of files is performed (e.g. 33UUV).")
parser.add_argument("-p", "--onlytime", action="store", required=False, type=str2bool, default=False,
help="get the available timestamps for a specific request without downloading any rasterdata")
parser.add_argument("-t", "--timeout", action="store", required=False, type=int, default=None,
help="time to wait for a response from gts2 before raising a Timeout exception")
args = parser.parse_args()
......@@ -944,4 +946,5 @@ if __name__ == "__main__":
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment