Image handler

Handler for work with a image

class luna_image_store.app.handlers.image_handler.ImageHandler(request)[source]

Handler for work with single image

Resource: “{api_version}/buckets/{bucketName}/images/{imageId}”

async delete(bucketName, imageId)[source]

Delete image from bucket. See spec_delete_image.

Parameters
  • bucketName (str) – bucket name

  • imageId (str) – image id

Return type

HTTPResponse

Returns

response with status code 204

async get(bucketName, imageId)[source]

Get image from bucket. See spec_get_image.

Parameters
  • bucketName (str) – bucket name

  • imageId (str) – image id

Return type

HTTPResponse

Returns

response with image in body, if status code 200

async head(bucketName, imageId)[source]

Check image exists in bucket. See spec_head_image.

Parameters
  • bucketName (str) – bucket name

  • imageId (str) – image id

Return type

HTTPResponse

Returns

response with status code 200, if image exist, Error.ImageNotFoundError with status code 404, if image with id not found.

async put(bucketName, imageId)[source]

Put image to bucket. See spec_put_image.

Parameters
  • bucketName (str) – bucket name

  • imageId (str) – image id

Return type

HTTPResponse

Returns

response with image location, if status code 200, Error.BadContentType with status code 400, if bad content type, Error.ConvertImageError with status code 400, if failed convert image bytes, Error.PageNotFoundError with status code 404, if page not found.