backup download_all_layers.py script

This commit is contained in:
Christian Schwarz
2023-10-26 08:14:08 +00:00
parent 68386c19a2
commit 4b7fddeabe

20
download_all_layers.py Normal file
View File

@@ -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']}")