Base handler¶
Base handler
Module realize base class for all handlers.
- class luna_api.app.handlers.base_handler.AccountsBaseHandler(request)[source]¶
Class for proxy handlers to accounts
- checkAccountType()[source]¶
Check account type in specified json is allowed :raises VLException(Error.BadInputJson.format(“”, accountType)) if account_type is not allowed:
- Return type:
None
- property serviceAddress: ServiceAddressSettings¶
Get a faces service address :returns: a faces service address
- Return type:
ServiceAddressSettings
- property serviceTimeouts: ServiceTimeoutsSettings¶
Get a faces service timeouts :returns: a faces service timeouts
- Return type:
ServiceTimeoutsSettings
- class luna_api.app.handlers.base_handler.BaseBodySampleProxyHandler(request)[source]¶
Base body sample proxy.
- property serviceAddress: ImageStoreAddressSettings¶
Get a image store service address :returns: a image store service address
- Return type:
ImageStoreAddressSettings
- property serviceTimeouts: ServiceTimeoutsSettings¶
Get a image store service timeouts :returns: a image store service timeouts
- Return type:
ServiceTimeoutsSettings
- class luna_api.app.handlers.base_handler.BaseFaceSampleProxyHandler(request)[source]¶
Base face sample proxy.
- property serviceAddress: ImageStoreAddressSettings¶
Get a image store service address :returns: a image store service address
- Return type:
ImageStoreAddressSettings
- property serviceTimeouts: ServiceTimeoutsSettings¶
Get a image store service timeouts :returns: a image store service timeouts
- Return type:
ServiceTimeoutsSettings
- class luna_api.app.handlers.base_handler.BaseProxyHandler(request)[source]¶
Base proxy handler for other handlers.
- checkTokenPermissionsDefault(objectName)[source]¶
Check token permissions for request using default method to permission map
- Return type:
None
- convertIncomingUrls(response)[source]¶
Convert service URLs to output JSON and update Location in handler :returns: output JSON with converted service URLs
- Return type:
Dict
[str
,str
]
- async delete(*args, **kwargs)[source]¶
Default ‘delete’ method :returns: proxy response
- Return type:
HTTPResponse
- async get(*args, **kwargs)[source]¶
Default ‘get’ method :returns: proxy response
- Return type:
HTTPResponse
- async makeRequestToService()[source]¶
Make request to custom service :returns: response
- Return type:
HTTPResponse
- async patch(*args, **kwargs)[source]¶
Default ‘patch’ method :returns: proxy response
- Return type:
HTTPResponse
- async post(*args, **kwargs)[source]¶
Default ‘post’ method :returns: proxy response
- Return type:
HTTPResponse
- async postProcessing(response)[source]¶
Post processing response :param response: response
- Returns:
response in api format
- Return type:
HTTPResponse
- postProcessingDefault(response)[source]¶
Default post processing response from the service :param response: response
- Returns:
response in api format
- Return type:
HTTPResponse
- async postProcessingDelete(response)[source]¶
Post processing response from the service for method delete :param response: response
- Returns:
response in api format
- Return type:
HTTPResponse
- async postProcessingGet(response)[source]¶
Post processing response from the service for method get :param response: response
- Returns:
response in api format
- Return type:
HTTPResponse
- async postProcessingHead(response)[source]¶
Post processing response from the service for method head :param response: response
- Returns:
response in api format
- Return type:
HTTPResponse
- async postProcessingOptions(response)[source]¶
Post processing response from the service for method post :param response: response
- Returns:
response in api format
- Return type:
HTTPResponse
- async postProcessingPatch(response)[source]¶
Post processing response from the service for method patch :param response: response
- Returns:
response in api format
- Return type:
HTTPResponse
- async postProcessingPost(response)[source]¶
Default post processing response from the service :param response: response
- Returns:
response in api format
- Return type:
HTTPResponse
- async postProcessingPut(response)[source]¶
Post processing response from the service for method put :param response: response
- Returns:
response in api format
- Return type:
HTTPResponse
- prepareHeaders()[source]¶
Prepare headers for a proxy request :returns: headers with Luna-Request-Id and other input headers
- Return type:
Dict
[str
,str
]
- prepareRequestCreation()[source]¶
Add account id to root json for creating some objects :returns: proxy request
- Raises:
VLException(Error.BadContentType) – if request has incorrect content type
- Return type:
- prepareRequestDefault()[source]¶
Prepare proxy request by default :returns: default proxy request
- Return type:
- async prepareRequestDelete()[source]¶
Prepare proxy request for method delete :returns: proxy request
- prepareUrl()[source]¶
Prepare url to a service :returns: same url with correct api version
- Return type:
str
- async put(*args, **kwargs)[source]¶
Default ‘put’ method :returns: proxy response
- Return type:
HTTPResponse
- property serviceAddress: ServiceAddressSettings¶
Get a proxed service address :returns: a proxed service address
- Return type:
ServiceAddressSettings
- property serviceTimeouts: ServiceTimeoutsSettings¶
Get a proxed service timeouts :returns: a proxed service timeouts
- Return type:
ServiceTimeoutsSettings
- property serviceUrl: str¶
Service url
- Return type:
str
- class luna_api.app.handlers.base_handler.BaseRequestHandler(request)[source]¶
Base handler for other handlers.
- luna3Client¶
luna3 client
- Type:
luna3.client.Client
- accountId¶
account id
- Type:
str
- property app: ApiApp¶
Get running app :returns: app
- Return type:
ApiApp
- property config: SettingsApi¶
Get app config :returns: app config
- Return type:
SettingsApi
- class luna_api.app.handlers.base_handler.EventServiceBaseHandler(*args, **kwargs)[source]¶
Class for proxy handlers to events
- property serviceAddress: ServiceAddressSettings¶
Get a events service address :returns: a events service address
- Return type:
ServiceAddressSettings
- property serviceTimeouts: ServiceTimeoutsSettings¶
Get a events service timeouts :returns: a events service timeouts
- Return type:
ServiceTimeoutsSettings
- class luna_api.app.handlers.base_handler.FacesServiceBaseHandler(request)[source]¶
Class for proxy handlers to faces
- property serviceAddress: ServiceAddressSettings¶
Get a faces service address :returns: a faces service address
- Return type:
ServiceAddressSettings
- property serviceTimeouts: ServiceTimeoutsSettings¶
Get a faces service timeouts :returns: a faces service timeouts
- Return type:
ServiceTimeoutsSettings
- class luna_api.app.handlers.base_handler.HandlersServiceBaseHandler(request)[source]¶
Class for proxy handlers to handlers
- convertAttributeUrls(replyJson)[source]¶
Convert attribute URLs in output JSON :param replyJson: JSON
- Returns:
output JSON with converted attribute URLs
- Return type:
dict
- convertDetectorSampleUrls(replyJson)[source]¶
Convert detections sample URLs in output JSON :param replyJson: JSON
- Returns:
output JSON with converted sample URLs
- Return type:
dict
- convertHandlerEventsUrls(replyJson)[source]¶
Convert events/faces/detections samples URLs in output JSON :param replyJson: JSON
- Returns:
output JSON with converted sample URLs
- Return type:
dict
- convertVerifierUrls(replyJson)[source]¶
Convert attribute and sample URLs in output JSON :param replyJson: JSON
- Returns:
output JSON with converted attribute URLs
- Return type:
dict
- property serviceAddress: ServiceAddressSettings¶
Get a handlers service address :returns: a handlers service address
- Return type:
ServiceAddressSettings
- property serviceTimeouts: ServiceTimeoutsSettings¶
Get a handlers service timeouts :returns: a handlers service timeouts
- Return type:
ServiceTimeoutsSettings
- class luna_api.app.handlers.base_handler.ProxyRequest(body: Any, headers: Union[Dict[str, str], CIMultiDictProxy[str]], query: Dict[str, Union[None, str]])[source]¶
Proxy request
- body: Any¶
Alias for field number 0
- headers: Union[Dict[str, str], CIMultiDictProxy[str]]¶
Alias for field number 1
- query: Dict[str, Union[None, str]]¶
Alias for field number 2
- class luna_api.app.handlers.base_handler.PythonMatcherServiceBaseHandler(request)[source]¶
Class for proxy handlers to python-matcher/python-matcher-proxy
- property serviceAddress: ServiceAddressSettings¶
Get a python matcher service address :returns: a python matcher service address
- Return type:
ServiceAddressSettings
- property serviceTimeouts: ServiceTimeoutsSettings¶
Get a python matcher service timeouts :returns: a python matcher service timeouts
- Return type:
ServiceTimeoutsSettings
- class luna_api.app.handlers.base_handler.TasksServiceBaseHandler(*args, **kwargs)[source]¶
Class for proxy handlers to tasks
- property serviceAddress: ServiceAddressSettings¶
Get a tasks service address :returns: a tasks service address
- Return type:
ServiceAddressSettings
- property serviceTimeouts: ServiceTimeoutsSettings¶
Get a tasks service timeouts :returns: a tasks service timeouts
- Return type:
ServiceTimeoutsSettings