Sorted remaining content_type issues and blackened

This commit is contained in:
Richard 2021-07-19 20:09:09 +01:00
parent 38fbe530d2
commit b7c9d3b73b
13 changed files with 114 additions and 92 deletions

View file

@ -4,4 +4,4 @@ from .captures import *
from .instrument import *
from .stage import *
from .streams import *
from .docs import *
from .docs import *

View file

@ -71,8 +71,8 @@ class RAMCaptureAPI(ActionView):
args = BasicCaptureArgs()
responses = {
200: {
"content": { "image/jpeg": {} },
"description": "A JPEG image, representing the capture"
"content": {"image/jpeg": {}},
"description": "A JPEG image, representing the capture",
}
}

View file

@ -14,7 +14,7 @@ class LSTImageProperty(PropertyView):
responses = {
200: {
"content": { "image/jpeg": {} },
"content": {"image/jpeg": {}},
"description": "Lens-shading table in RGB format",
}
}

View file

@ -146,8 +146,19 @@ class CaptureList(PropertyView):
return image_list
CAPTURE_ID_PARAMETER = {
"name": "id_",
"in": "path",
"description": "The unique ID of the capture",
"required": True,
"schema": {"type": "string"},
"example": "eeae7ae9-0c0d-45a4-9ef2-7b84bb67a1d1",
}
class CaptureView(View):
tags = ["captures"]
parameters = [CAPTURE_ID_PARAMETER]
@marshal_with(FullCaptureSchema())
def get(self, id_):
@ -162,6 +173,8 @@ class CaptureView(View):
return capture_obj
get.responses = {404: {"description": "Capture object was not found"}}
def delete(self, id_):
"""
Delete a single image capture
@ -182,7 +195,10 @@ class CaptureView(View):
class CaptureDownload(View):
tags = ["captures"]
responses = {200: {"content_type": "image/jpeg"}}
responses = {
200: {"content": {"image/jpeg": {}}, "description": "Image data in JPEG format"}
}
parameters = [CAPTURE_ID_PARAMETER]
def get(self, id_, filename: Optional[str]):
"""
@ -223,6 +239,7 @@ class CaptureDownload(View):
class CaptureTags(View):
tags = ["captures"]
parameters = [CAPTURE_ID_PARAMETER]
def get(self, id_):
"""
@ -270,6 +287,7 @@ class CaptureTags(View):
class CaptureAnnotations(View):
tags = ["captures"]
parameters = [CAPTURE_ID_PARAMETER]
def get(self, id_):
"""

View file

@ -2,6 +2,7 @@ from labthings.views import View
from labthings import current_labthing
from flask import Response
class APISpecJSONView(View):
"""OpenAPI v3 documentation
@ -11,6 +12,7 @@ class APISpecJSONView(View):
def get(self):
return current_labthing().spec.to_dict()
class APISpecYAMLView(View):
"""OpenAPI v3 documentation
@ -18,4 +20,4 @@ class APISpecYAMLView(View):
"""
def get(self):
return Response(current_labthing().spec.to_yaml(), mimetype='text/yaml')
return Response(current_labthing().spec.to_yaml(), mimetype="text/yaml")

View file

@ -19,9 +19,7 @@ class MjpegStream(PropertyView):
responses = {
200: {
"content": {
"multipart/x-mixed-replace": {}
},
"content": {"multipart/x-mixed-replace": {}},
"description": (
"An MJPEG stream of camera images.\n\n"
"This endpoint will serve JPEG images sequentially, \n"
@ -62,12 +60,7 @@ class SnapshotStream(PropertyView):
Single JPEG snapshot from the camera stream
"""
responses = {
200: {
"content": { "image/jpeg": {} },
"description": "Snapshot taken"
}
}
responses = {200: {"content": {"image/jpeg": {}}, "description": "Snapshot taken"}}
def get(self):
"""