Set and delete downtime with REST API

you can just refactor the code fragment you need without the Literal, so Literal basically ensures that some expression has literally a specific value, this code for instance ensures that mode is one of the list members:

DowntimeMode = Literal[
    "host",
    "service",
    "hostgroup",
    "servicegroup",
]  # yapf: disable

but it can be written this way and ensure that mode is a member of DowntimeMode::

DowntimeMode = [
    "host",
    "service",
    "hostgroup",
    "servicegroup",
]  # yapf: disable

if mode not in DowntimeMode:
    raise RuntimeError("Unsupported downtime mode: {}".format(mode))

Anyways you still have the option to use the old script as well, it can be found here