25 lines
859 B
Python
25 lines
859 B
Python
#!/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)
|