24 lines
1.2 KiB
Python
24 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
import argparse
|
|
from common import add_common_arguments, ask, ask_with_default, client_from_args, run
|
|
parser = argparse.ArgumentParser(description="POI ändern")
|
|
add_common_arguments(parser)
|
|
parser.add_argument("--route-id", type=int)
|
|
parser.add_argument("--poi-id", type=int)
|
|
args = parser.parse_args()
|
|
def action():
|
|
client = client_from_args(args)
|
|
route_id = ask("Route-ID", args.route_id, required=True, cast=int)
|
|
poi_id = ask("POI-ID", args.poi_id, required=True, cast=int)
|
|
current = client.request("GET", f"/api/routes/{route_id}/pois/{poi_id}")
|
|
body = {
|
|
"title": ask_with_default("Titel", current.get("title", "")),
|
|
"description": ask_with_default("Beschreibung", current.get("description", "")),
|
|
"lat": ask_with_default("Breitengrad", current.get("lat"), float),
|
|
"lon": ask_with_default("Längengrad", current.get("lon"), float),
|
|
"triggerRadiusM": ask_with_default("Auslöseradius in Metern", current.get("triggerRadiusM"), float),
|
|
"sequence": ask_with_default("Reihenfolge", current.get("sequence"), int),
|
|
}
|
|
return client.request("PUT", f"/api/routes/{route_id}/pois/{poi_id}", json_body=body)
|
|
run(action)
|