30 lines
989 B
Python
30 lines
989 B
Python
#!/usr/bin/env python3
|
|
"""Löscht einen POI einschließlich seiner Medien."""
|
|
|
|
import argparse
|
|
from collections.abc import Sequence
|
|
|
|
from common import add_common_arguments, ask, client_from_args, confirm, run
|
|
|
|
|
|
def build_parser() -> argparse.ArgumentParser:
|
|
parser = argparse.ArgumentParser(description="POI einschließlich Medien löschen")
|
|
add_common_arguments(parser)
|
|
parser.add_argument("--route-id", type=int)
|
|
parser.add_argument("--poi-id", type=int)
|
|
return parser
|
|
|
|
|
|
def main(argv: Sequence[str] | None = None):
|
|
args = build_parser().parse_args(argv)
|
|
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)
|
|
if not confirm(f"POI {poi_id} einschließlich Bilder und Audio löschen?"):
|
|
return {"cancelled": True}
|
|
return client.request("DELETE", f"/api/routes/{route_id}/pois/{poi_id}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
run(main)
|