Streamlined POST methods with get_from_payload()

This commit is contained in:
Joel Collins 2018-11-21 12:19:21 +00:00
parent 1dad25ee62
commit 53e5cfd01f
2 changed files with 16 additions and 22 deletions

View file

@ -5,6 +5,14 @@ def parse_payload(request):
return state
def get_from_payload(payload, key, default=None):
"""Check if a key exists in a JSON/dictionary payload, and returns it."""
if key in payload:
return payload[key]
else:
return default
def gen(camera):
"""Video streaming generator function."""
while True: