luna_lambda_tools.public.user_handlers.base_handler.LambdaUserHandler
- class luna_lambda_tools.public.user_handlers.base_handler.LambdaUserHandler(request)[source]
Base class for user handlers
- __init__(request)
Methods
__init__
(request)addDataForMonitoring
([tags, fields])Add data to request monitoring
as_view
(*class_args, **class_kwargs)Return view function for use with the routing system, that dispatches request to appropriate handler method.
attach
(to, uri[, methods, host, ...])Attaches the view to a Sanic app or Blueprint at the specified URI.
dispatchRequest
(request, *args, **kwargs)Overload dispatch_request, remove request fro handler method arguments :type request:
TypeVar
(TRequest
) :param request: request :type *args: :param *args: args :type **kwargs: :param **kwargs: kwargsdispatch_request
(request, *args, **kwargs)Dispatch request to appropriate handler method.
error
(statusCode, error)Function, that creates error response.
getAccountIdFromHeader
([required])Get required account id from header Luna-Account-Id :type required:
bool
:param required: whether header must be specifiedgetAllowedMethods
()Get Allowed methods for resource
getPagination
([defaultPage, ...])Getting pagination
getQueryParam
(name[, validator, require, ...])Getting query param
loadDataFromJson
(data, model)Load data from json with pydantic :type data:
dict
:param data: input data :type model:Type
[BaseModel
] :param model: pydantic modelloadDataFromQuery
(model)Load data from query with pydantic :type model:
Type
[BaseModel
] :param model: pydantic modelsendResponse
([statusCode, json, body, headers])Send response
setMethodNotAllowed
()Set error "method not allowed" and status code 405
stream
(producer, contentType[, headers, status])Interface for streaming data with async_generator.
success
([statusCode, body, outputJson, ...])Finish success request.
validateJson
(data, schema[, useJsonSchema])Validate json or msgpack.
Attributes
app
Get sanic application.
config
Get app config :returns: app config
decorators
route
request
get