included scripts for api interaction
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user