Created API V1
This commit is contained in:
parent
d04943c944
commit
973ccf67ab
8 changed files with 132 additions and 18 deletions
15
openflexure_microscope/api/utilities.py
Normal file
15
openflexure_microscope/api/utilities.py
Normal 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')
|
||||
Loading…
Add table
Add a link
Reference in a new issue