Source code for luna_api.app.handlers.faces_proxy_handler

""" Handler for a certain faces. """
from luna3.common.luna_response import LunaResponse
from sanic.response import HTTPResponse

from app.handlers.base_handler import FacesServiceBaseHandler, ProxyRequest


[docs]class FacesHandler(FacesServiceBaseHandler): """ Handler for create new faces. See `spec_faces`_. .. _spec_faces: _static/api.html#tag/faces Resource: "/{api_version}/faces" """ allowedMethods = ("POST", "GET", "DELETE")
[docs] async def prepareRequestPost(self) -> ProxyRequest: """ Add account id to new face Returns: proxy request """ return self.prepareRequestCreation()
[docs] async def postProcessingPost(self, response: LunaResponse) -> HTTPResponse: """ Update urls in output json and location header Args: response: from faces Returns: response """ return self.success(response.statusCode, outputJson=self.convertIncomingUrls(response))
[docs]class FacesCountHandler(FacesServiceBaseHandler): """ Handler for getting face count. See `spec_get_faces_count`_. .. _spec_get_faces_count: _static/api.html#operation/getFacesCount Resource: "/{api_version}/faces/count" """ allowedMethods = ("GET",)
[docs]class FaceHandler(FacesServiceBaseHandler): """ Handler for work with a face. See `spec_face`_. .. _spec_face: _static/api.html#tag/faces Resource: "/{api_version}/faces/{faceId}" """ allowedMethods = ("PATCH", "GET", "DELETE", "HEAD")
[docs]class FacesAttributeHandler(FacesServiceBaseHandler): """ Handler for work with a face attributes. See `spec_face_attributes`_. .. _spec_face_attributes: _static/api.html#tag/face-attributes Resource: "/{api_version}/faces/{faceId}/attributes" """ allowedMethods = ("PUT", "GET", "DELETE")
[docs]class FacesAttributesCountHandler(FacesServiceBaseHandler): """ Handler for getting count faces with attributes. See `spec_get_face_attribute_count`_. .. _spec_get_face_attribute_count: _static/api.html#operation/getFaceAttributeCount Resource: "/{api_version}/faces/attributes/count" """ allowedMethods = ("GET",)
[docs]class FacesAttributeSamplesHandler(FacesServiceBaseHandler): """ Handler for work with face attribute samples. See `spec_get_face_attribute_samples`_. .. _spec_get_face_attribute_samples: _static/api.html#operation/getFaceAttributeSamples Resource: "/{api_version}/faces/{faceId}/attributes/samples" """ allowedMethods = ("GET",)