From 4b7fddeabeeb6e7d3369e59239fa7aacdae0155c Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Thu, 26 Oct 2023 08:14:08 +0000 Subject: [PATCH] backup download_all_layers.py script --- download_all_layers.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 download_all_layers.py diff --git a/download_all_layers.py b/download_all_layers.py new file mode 100644 index 0000000000..883da5d3a4 --- /dev/null +++ b/download_all_layers.py @@ -0,0 +1,20 @@ +import requests + +tenants = requests.get("http://localhost:15003/v1/tenant") +tenants.raise_for_status() +tenants = tenants.json() + +for tenant in tenants: + id = tenant["id"] + timelines = requests.get(f"http://localhost:15003/v1/tenant/{id}/timeline") + timelines.raise_for_status() + for timeline in timelines.json(): + tid = timeline["tenant_id"] + tlid = timeline["timeline_id"] + layers = requests.get(f"http://localhost:15003/v1/tenant/{tid}/timeline/{tlid}/layer") + layers.raise_for_status() + layers = layers.json() + for l in layers["historic_layers"]: + if l["remote"] == False: + requests.get(f"http://localhost:15003/v1/tenant/{tid}/timeline/{tlid}/layer/{l['layer_file_name']}") +