Created API V1

This commit is contained in:
Joel Collins 2018-11-08 15:02:04 +00:00
parent d04943c944
commit 973ccf67ab
8 changed files with 132 additions and 18 deletions

View file

@ -0,0 +1,15 @@
def parse_payload(request):
"""Convert request to JSON. Will eventually handle error-checking."""
# TODO: Handle invalid JSON payloads
state = request.get_json()
return state
def gen(camera):
"""Video streaming generator function."""
while True:
# the obtained frame is a jpeg
frame = camera.get_frame()
yield (b'--frame\r\n'
b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n')