Streamlined POST methods with get_from_payload()
This commit is contained in:
parent
1dad25ee62
commit
53e5cfd01f
2 changed files with 16 additions and 22 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue