chat.utils

Module Contents

Functions

param_from_path(→ str)

Retrieve any query parameter from a path.

chat.utils.param_from_path(name: str, path: str) str[source]

Retrieve any query parameter from a path.

Raises ValueError if path is not a valid URL path or if it does not contain exactly one query parameter named name. Multiple parameters with that name are not supported and will result in ValueError, as it hints to a misconfiguration.

Example:
>>> schema_from_path("schema", "/chats?schema=onegov_town6-meggen")
'onegov_town6-meggen