Samples handler

Save samples to storage

class luna_api.app.handlers.samples_handler.BodySamplesProxyHandler(request)[source]

Body sample proxy handler. See spec body samples.

Resource: “/{api_version}/samples/bodies”

checkWarpedImage(warp)[source]

Check whether image is warped.

Parameters:

warp – warp to check

Raises:

VLException

Return type:

None

prepareLocationHeader(sampleId)[source]

Prepare relative url to the created image.

Returns:

A str, url

Return type:

str

class luna_api.app.handlers.samples_handler.FaceSamplesProxyHandler(request)[source]

Face sample proxy handler. See spec face samples.

Resource: “/{api_version}/samples/faces”

checkWarpedImage(warp)[source]

Check whether image is warped.

Parameters:

warp – warp to check

Raises:

VLException

Return type:

None

prepareLocationHeader(sampleId)[source]

Prepare relative url to the created image.

Returns:

A str, url

Return type:

str

luna_api.app.handlers.samples_handler.checkWarpedImage(byteImg, expectedSize)[source]

Check image is warp (checking size and type).

Parameters:
  • byteImg – images

  • expectedSize – expected image size

Raises:
  • VLException(Error.BadContentType, 400, isCriticalError=False) – if mime type is not ‘JPEG’

  • VLException(Error.BadWarpImageSize, 400, isCriticalError=False) – if image size is not valid

Return type:

None