INNER CODE UNIT · Python
get_param
selkies-project/selkies · addons/turn-rest/app.py:100
def get_param(name: str, json_payload: Any) -> Optional[Any]:
"""Read a request parameter from query/form values, then the JSON body."""
value = request.values.get(name)
if value is not None:
return value
if isinstance(json_payload, dict):
return json_payload.get(name)
return None
@app.route('/', methods=['GET', 'POST'])
def turn_rest():
"""Mint a time-limited TURN credential per the TURN REST API.
Returns:
JSON with ``username`` (`expiry:user`), the HMAC-SHA1 ``password``,
``ttl``, and the ``uris`` list, or a plain-text error with a 4xx
status for a bad service or API key.