included scripts for api interaction

This commit is contained in:
Florian Zumpe
2026-06-17 11:41:36 +02:00
parent a697e293cb
commit 3b3069ca8c
16 changed files with 573 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env python3
import argparse
from common import add_common_arguments, ask, ask_path, client_from_args, run
parser = argparse.ArgumentParser(description="Neue Wegwichtel-Route anlegen")
add_common_arguments(parser)
parser.add_argument("--gpx")
parser.add_argument("--name")
parser.add_argument("--slug")
parser.add_argument("--description")
parser.add_argument("--school-name")
args = parser.parse_args()
def action():
client = client_from_args(args)
gpx = ask_path("GPX-Datei", args.gpx)
fields = {
"name": ask("Name (leer: GPX-Name)", args.name),
"slug": ask("Slug (leer: automatisch)", args.slug),
"description": ask("Beschreibung", args.description),
"schoolName": ask("Schule", args.school_name),
}
return client.request("POST", "/api/routes", fields=fields, files={"gpx": gpx})
run(action)