Luna services clients description
Here presented possibilities of luna-services clients.
Events client
The luna-events client which allows to create events, get events and get events statistics
Module contains luna-events client adapted for usage in lambda
- class luna_lambda_tools.public.clients.events.Events(eventsClient, accountId)[source]
Luna-events client
- deleteEvents(target=None, handlerId=None, createTimeGte=None, createTimeLt=None, insertTimeGte=None, insertTimeLt=None, raiseError=True, **kwargs)[source]
Delete events by filters.
- Parameters:
target (
UnionType[list[str],None]) – event deletion info targetshandlerId (
UnionType[str,None]) – event handler idcreateTimeGte (
UnionType[str,None]) – lower including create time boundarycreateTimeLt (
UnionType[str,None]) – upper excluding create time boundaryinsertTimeGte (
UnionType[str,None]) – lower including insert time boundaryinsertTimeLt (
UnionType[str,None]) – upper excluding insert time boundaryraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with events will be returned.
- Return type:
class
- getEvent(eventId, target=None, raiseError=True, **kwargs)[source]
Get event by id.
- Parameters:
eventId (
str) – event idtarget (
UnionType[list[Literal[‘account_id’, ‘create_time’, ‘end_time’, ‘event_id’, ‘handler_id’, ‘external_id’, ‘source’, ‘stream_id’, ‘top_match’, ‘match_result’, ‘face_detections’, ‘face_id’, ‘attach_result’, ‘gender’, ‘age’, ‘emotion’, ‘ethnic_group’, ‘liveness’, ‘deepfake’, ‘body_detections’, ‘body_basic_attributes’, ‘upper_body’, ‘lower_body’, ‘accessories’, ‘tags’, ‘user_data’, ‘location’, ‘mask’, ‘track_id’, ‘meta’]],None]) – list of events’ fields to receive instead of full eventsraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with events will be returned.
- Return type:
class
- getEventDescriptor(eventId=None, descriptorVersion=None, descriptorType=None, raiseError=True, **kwargs)[source]
Get event descriptor by filters.
- Parameters:
eventId (
UnionType[str,None]) – event iddescriptorVersion (
UnionType[int,None]) – descriptor versiondescriptorType (
UnionType[str,None]) – Kind of the descriptor (body or face)raiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with event descriptor will be returned.
- Return type:
class
- getEvents(target=None, createTimeGte=None, createTimeLt=None, endTimeGte=None, endTimeLt=None, eventIds=None, eventIdGte=None, eventIdLt=None, handlerIds=None, externalIds=None, topMatchingCandidatesLabel=None, topSimilarObjectIds=None, topSimilarExternalIds=None, topSimilarObjectSimilarityGte=None, topSimilarObjectSimilarityLt=None, ageLt=None, ageGte=None, gender=None, emotions=None, masks=None, ethnicGroups=None, liveness=None, apparentAgeGte=None, apparentAgeLt=None, apparentGender=None, headwearStates=None, headwearApparentColors=None, sleeveLengths=None, upperClothingColors=None, lowerGarmentTypes=None, lowerGarmentColors=None, shoesApparentColors=None, backpackStates=None, faceIds=None, userData=None, page=1, pageSize=10, order='desc', sources=None, tags=None, cities=None, areas=None, districts=None, streets=None, houseNumbers=None, originLongitude=None, originLatitude=None, longitudeDelta=None, latitudeDelta=None, trackIds=None, meta=None, raiseError=True, **kwargs)[source]
Get events by filters.
- Parameters:
target (
UnionType[list[Literal[‘account_id’, ‘create_time’, ‘end_time’, ‘event_id’, ‘handler_id’, ‘external_id’, ‘source’, ‘stream_id’, ‘top_match’, ‘match_result’, ‘face_detections’, ‘face_id’, ‘attach_result’, ‘gender’, ‘age’, ‘emotion’, ‘ethnic_group’, ‘liveness’, ‘deepfake’, ‘body_detections’, ‘body_basic_attributes’, ‘upper_body’, ‘lower_body’, ‘accessories’, ‘tags’, ‘user_data’, ‘location’, ‘mask’, ‘track_id’, ‘meta’]],None]) – list of events’ fields to receive instead of full eventscreateTimeGte (
UnionType[str,None]) – lower including create time boundarycreateTimeLt (
UnionType[str,None]) – upper excluding create time boundaryendTimeGte (
UnionType[str,None]) – lower including end time boundaryendTimeLt (
UnionType[str,None]) – upper excluding end time boundaryfaceIds (
UnionType[list[str],None]) – ids of faces linked with an eventeventIds (
UnionType[list[str],None]) – event idseventIdGte (
UnionType[str,None]) – event id lower including boundeventIdLt (
UnionType[str,None]) – event id upper excluding boundhandlerIds (
UnionType[list[str],None]) – handler idsexternalIds (
UnionType[list[str],None]) – external idsuserData (
UnionType[str,None]) – event user datasources (
UnionType[list[Union[str,Literal[‘null’]]],None]) – list of sourcetags (
UnionType[list[str],None]) – users tagstopMatchingCandidatesLabel (
UnionType[str,None]) – top matching candidates labeltopSimilarObjectIds (
UnionType[list[str],None]) – top similar object idstopSimilarExternalIds (
UnionType[list[str],None]) – top similar external idstopSimilarObjectSimilarityGte (
UnionType[float,None]) – lower including top similarity boundarytopSimilarObjectSimilarityLt (
UnionType[float,None]) – upper excluding top similarity boundaryageLt (
UnionType[int,None]) – upper excluding age boundaryageGte (
UnionType[int,None]) – lower including age boundarygender (
Union[int,Literal[‘null’],None]) – gender of event (0 or 1)emotions (
UnionType[list[Union[int,Literal[‘null’]]],None]) – dominant emotions in event (one of (1, 2, 3, 4, 5, 6, 7) - matches “anger”, “disgust”, “fear”, “happiness”, “neutral”, “sadness”, “surprise”)masks (
UnionType[list[Union[int,Literal[‘null’]]],None]) – dominant masks in event (one of (1, 2, 3) - matches “missing”, “medical_mask”, “occluded”)ethnicGroups (
UnionType[list[Union[int,Literal[‘null’]]],None]) – dominant ethnicity of the face ((1, 2, 3, 4) - means (indian, asian, african_american, caucasian)liveness (
UnionType[list[Union[int,Literal[‘null’]]],None]) – dominant liveness of the face ((0, 1, 2) - means (“spoof”, “real”, “unknown”))apparentAgeLt (
UnionType[int,None]) – apparent age upper excluding boundaryapparentAgeGte (
UnionType[int,None]) – apparent age upper including boundaryapparentGender (
Union[list[Literal[0, 1, 2]],Literal[‘null’]]) – apparent gender estimation values (0 - female, 1 - male, 2 - undefined)headwearStates (
UnionType[list[Union[Literal[0, 1, 2],Literal[‘null’]]],None]) – headwear states (0 - absent, 1 - present, 2 - undefined)headwearApparentColors (
UnionType[list[Union[Literal[‘undefined’, ‘black’, ‘white’, ‘other’],Literal[‘null’]]],None]) – headwear apparent colorssleeveLengths (
UnionType[list[Literal[‘short’, ‘long’, ‘undefined’, ‘null’]],None]) – sleeve lengthsupperClothingColors (
UnionType[list[Union[Literal[‘black’, ‘blue’, ‘green’, ‘gray’, ‘orange’, ‘purple’, ‘red’, ‘white’, ‘yellow’, ‘pink’, ‘brown’, ‘beige’, ‘khaki’, ‘multicolored’, ‘undefined’],Literal[‘null’]]],None]) – upper clothing colorslowerGarmentTypes (
UnionType[list[Literal[‘undefined’, ‘trousers’, ‘shorts’, ‘skirt’, ‘null’]],None]) – lower garment typeslowerGarmentColors (
UnionType[list[Union[Literal[‘black’, ‘blue’, ‘green’, ‘gray’, ‘orange’, ‘purple’, ‘red’, ‘white’, ‘yellow’, ‘pink’, ‘brown’, ‘beige’, ‘khaki’, ‘multicolored’, ‘undefined’],Literal[‘null’]]],None]) – lower garment colorsshoesApparentColors (
UnionType[list[Union[Literal[‘undefined’, ‘black’, ‘white’, ‘other’],Literal[‘null’]]],None]) – shoes apparent colorsbackpackStates (
UnionType[list[Union[Literal[0, 1, 2],Literal[‘null’]]],None]) – backpack states (0 - absent, 1 - present, 2 - undefined)areas (
UnionType[list[Union[str,Literal[‘null’]]],None]) – list of areasstreets (
UnionType[list[Union[str,Literal[‘null’]]],None]) – list of streetsdistricts (
UnionType[list[Union[str,Literal[‘null’]]],None]) – list of districtscities (
UnionType[list[Union[str,Literal[‘null’]]],None]) – list of citieshouseNumbers (
UnionType[list[Union[str,Literal[‘null’]]],None]) – list of house numbersoriginLongitude (
Union[float,Literal[‘null’],None]) – origin longitude in degreesoriginLatitude (
Union[float,Literal[‘null’],None]) – origin latitude in degreeslongitudeDelta (
UnionType[float,None]) – longitude delta in degreeslatitudeDelta (
UnionType[float,None]) – latitude delta in degreestrackIds (
UnionType[list[Union[str,Literal[‘null’]]],None]) – list of track idsmeta (
UnionType[dict,None]) – user-defined event meta’s filters in format {meta.<path.to.field>__<operator>:<type>: <value>}page (
UnionType[int,None]) – number of result pagepageSize (
UnionType[int,None]) – count of results in pageorder (
UnionType[str,None]) – result sort order (ask or desc)raiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with events will be returned.
- Return type:
class
- getEventsStats(query=<luna3.common.http_objs.StatQuery object>, raiseError=True, **kwargs)[source]
Get events statistics by aggregation (<aggregator> and <groupBy> on <target>) and filters.
- Parameters:
query (
StatQuery) – query object or query dict, contained in StatQuery objectraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with event statistics will be returned.
- Return type:
class
- headEvent(eventId, raiseError=True, **kwargs)[source]
Check event existence by id.
- Parameters:
eventId (
str) – event idraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with events will be returned.
- Return type:
class
- saveEvents(events, waitEventsSaving=None, raiseError=True, **kwargs)[source]
Save events to luna-events.
- Parameters:
events (
list[Event]) – list of eventswaitEventsSaving (
UnionType[bool,None]) – whether to wait events saving (response will be received only after events will be saved)raiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse.
- Return type:
class
Faces client
The luna-faces client which allows to create/get/delete faces/attributes/lists
Module contains luna-faces client adapted for usage in lambda
- class luna_lambda_tools.public.clients.faces.Faces(facesClient, accountId)[source]
Luna-faces client
- createAttribute(basicAttributes=None, descriptors=None, descriptorSamples=None, basicAttributesSamples=None, xpk=None, ttl=None, raiseError=True, **kwargs)[source]
Create new attributes. Notice that XPK argument overwrites basic attributes and descriptors above.
- Parameters:
descriptors (
UnionType[list[UnionType[bytes,RawDescriptor]],None]) – list of descriptors different versionsdescriptorSamples (
list[str]) – list of warp image id from which the attribute was extracted.basicAttributes (
UnionType[dict,None]) – dict with basic attributes (age, gender, ethnicity)basicAttributesSamples (
list[str]) – list of warp image id from which the basic attribute was extracted.xpk (
bytes) – SDKObject bytes to load attributes fromttl (
UnionType[int,None]) – temporary attribute ttlraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse will return json with attribute id.
- Return type:
class
- createFace(attributeId=None, basicAttributes=None, descriptors=None, descriptorSamples=None, basicAttributesSamples=None, eventId=None, userData='', externalId=None, avatar=None, listIds=None, raiseError=True, **kwargs)[source]
Create new face in luna-faces
- Parameters:
attributeId (
UnionType[str,None]) – attribute iddescriptors (
UnionType[list[UnionType[bytes,RawDescriptor]],None]) – list of descriptors different versionsdescriptorSamples (
list[str]) – list of warp image id from which the attribute was extracted.basicAttributes (
UnionType[dict,None]) – dict with basic attributes (age, gender, ethnicity)basicAttributesSamples (
list[str]) – list of warp image id from which the basic attribute was extracted.eventId (
UnionType[str,None]) – reference to event which created faceuserData (
UnionType[str,None]) – face user dataexternalId (
UnionType[str,None]) – external id of the face, if it has its own mapping in the systemavatar (
UnionType[str,None]) – face avatar urllistIds (
UnionType[list[str],None]) – created face will be attach to these listsraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with created face id will be returned.
- Return type:
class
- createList(userData='', listId=None, raiseError=True, **kwargs)[source]
Create list.
- Parameters:
userData (
str) – user datalistId (
UnionType[str,None]) – custom list id to create the listraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with created list id will be returned.
- Return type:
class
- deleteAttribute(attributeId, raiseError=True, **kwargs)[source]
Delete attribute with specifeid id
- Parameters:
attributeId (
str) – attribute idraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse will return response empty body.
- Return type:
class
- deleteFace(faceId, raiseError=True, **kwargs)[source]
Delete face. Optional you can set, that face must belong to account.
- Parameters:
faceId (
str) – face idraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse.
- Return type:
class
- deleteFaceAttributes(faceId, raiseError=True, **kwargs)[source]
Delete face attributes.
- Parameters:
faceId (
str) – face idraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse
- Return type:
class
- deleteFaces(faceIds, ignore=None, raiseError=True, **kwargs)[source]
Delete faces. Optional you can set, that faces must belong to account.
- Parameters:
faceIds (
list[str]) – face id listignore (
UnionType[int,None]) – ignore non-existing facesraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse.
- Return type:
class
- deleteList(listId, withFaces=0, raiseError=True, **kwargs)[source]
Remove list. Optional you can set, that list must belong to account.
- Parameters:
listId (
str) – list idwithFaces (
int) – remove lists and all faces witch is contained in the listsraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse.
- Return type:
class
- deleteLists(listIds, withFaces=None, raiseError=True, **kwargs)[source]
Delete lists. Optional you can set, that lists must belong to account.
- Parameters:
listIds (
list[str]) – ids of listswithFaces (
int) – remove lists and all the faces contained in the listsraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse.
- Return type:
class
- getAttribute(attributeId, descriptorVersion=None, targets=None, raiseError=True, **kwargs)[source]
Retrieve a attribute by id.
- Parameters:
attributeId (
str) – attribute idtargets (
UnionType[list[str],None]) – Available targets: descriptor, basic_attributes, basic_attributes_samples, face_descriptors_samples, account_id, create_timedescriptorVersion (
int) – descriptor version to receiveraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse will return json with attribute.
- Return type:
class
- getAttributeIds(listId=None, timeLt=None, timeGte=None, page=1, pageSize=1000, raiseError=True, **kwargs)[source]
Get ids of attributes from list by period.
- Parameters:
listId (
UnionType[str,None]) – list idtimeLt (
UnionType[str,None]) – upper bound of face update timetimeGte (
UnionType[str,None]) – lower bound of face update timepage (
UnionType[int,None]) – page, default 1pageSize (
UnionType[int,None]) – page size, default 1000, max 100000raiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with attributes ids will be returned.
- Return type:
class
- getAttributeSamples(attributeId, raiseError=True, **kwargs)[source]
Retrieve a attribute by id.
- Parameters:
attributeId (
str) – attribute idraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse will return json with samples.
- Return type:
class
- getAttributes(attributeIds, descriptorVersion=None, targets=None, raiseError=True, **kwargs)[source]
Get list of attributes
- Parameters:
attributeIds (
list[str]) – list of attributes of interesttargets (
UnionType[list[str],None]) – Available targets: descriptor, basic_attributes, basic_attributes_samples, face_descriptors_samples, account_id, create_timedescriptorVersion (
int) – descriptor version to receiveraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse will return json with version.
- Return type:
class
- getAttributesFromList(listId, linkKeyLt=None, linkKeyGte=None, limit=1000, parity=None, raiseError=True, **kwargs)[source]
Get all attributes from list by period.
- Parameters:
listId (
str) – list idlinkKeyLt (
UnionType[str,None]) – upper including link key boundarylinkKeyGte (
UnionType[str,None]) – lower including link key boundarylimit (
UnionType[int,None]) – limitparity (
UnionType[int,None]) – if 1 - get with even and odd max link keys else max link keyraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with attributes will be returned.
- Return type:
class
- getFace(faceId, targets=None, raiseError=True, **kwargs)[source]
Get face by id. Optional you can set, that face must belong to account.
- Parameters:
faceId (
str) – face idtargets (
UnionType[list[str],None]) – targets to get faceraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with face will be returned.
- Return type:
class
- getFaceAttributeSamples(faceId, raiseError=True, **kwargs)[source]
Get face attribute samples.
- Parameters:
faceId (
str) – face idraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with attribute samples will be returned.
- Return type:
class
- getFaceAttributes(faceId, targets=None, descriptorVersion=None, raiseError=True, **kwargs)[source]
Get face attributes.
- Parameters:
faceId (
str) – face idtargets (
UnionType[list[str],None]) – targets to get face attributes. Available targets: create_time, face_descriptor, basic_attributes, face_descriptor_samples, basic_attributes_samples.descriptorVersion (
UnionType[int,None]) – descriptor versionraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with attributes will be returned.
- Return type:
class
- getFaces(userData=None, eventId=None, listId=None, faceIds=None, timeLt=None, timeGte=None, page=1, pageSize=10, attributeIds=None, externalIds=None, faceIdGte=None, faceIdLt=None, targets=None, raiseError=True, **kwargs)[source]
Get faces by filters. Optional you can set, that faces must belong to account.
- Parameters:
userData (
UnionType[str,None]) – user data, part of user data, case insensitiveeventId (
UnionType[str,None]) – event idlistId (
UnionType[str,None]) – list idfaceIds (
UnionType[list[str],None]) – face idstimeLt (
UnionType[str,None]) – upper bound of face create timetimeGte (
UnionType[str,None]) – lower bound of face create timepage (
UnionType[int,None]) – page count, default 1pageSize (
UnionType[int,None]) – page size, default 10, unlimited if -1attributeIds (
UnionType[list[str],None]) – attributes idsexternalIds (
UnionType[list[str],None]) – list of external identifiers of persons, if they have their own mapping in the systemfaceIdGte (
UnionType[str,None]) – lower face id including boundaryfaceIdLt (
UnionType[str,None]) – upper face id excluding boundarytargets (
UnionType[list[str],None]) – targets to get facesraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with faces will be returned.
- Return type:
class
- getFacesAttributes(faceIds, raiseError=True, **kwargs)[source]
Return attributeId of faces from faceIds list
- Parameters:
faceIds (
list) – list of faceId for return their attributesraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with attributes ids will be returned.
- Return type:
class
- getFacesCount(userData=None, eventId=None, listId=None, faceIds=None, timeLt=None, timeGte=None, attributeIds=None, externalIds=None, faceIdGte=None, faceIdLt=None, raiseError=True, **kwargs)[source]
Count faces by filters. Optional you can set, that faces must belong to account.
- Parameters:
userData (
UnionType[str,None]) – user data, part of user data, case insensitiveeventId (
UnionType[str,None]) – event idlistId (
UnionType[str,None]) – list idfaceIds (
UnionType[list[str],None]) – face idstimeLt (
UnionType[str,None]) – upper bound of face create timetimeGte (
UnionType[str,None]) – lower bound of face create timeattributeIds (
UnionType[list[str],None]) – attributes idsexternalIds (
UnionType[list[str],None]) – list of external identifiers of persons, if they have their own mapping in the systemfaceIdGte (
UnionType[str,None]) – lower face id including boundaryfaceIdLt (
UnionType[str,None]) – upper face id excluding boundaryraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with number of faces will be returned.
- Return type:
class
- getList(listId, page=1, pageSize=10, raiseError=True, **kwargs)[source]
Get list. Optional you can set, that list must belong to account.
- Parameters:
listId (
str) – list idpage (
UnionType[int,None]) – page count, default 1pageSize (
UnionType[int,None]) – page size, default 10raiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with list will be returned.
- Return type:
class
- getLists(userData=None, userDataEq=None, createTimeLt=None, createTimeGte=None, lastUpdateTimeLt=None, lastUpdateTimeGte=None, listIds=None, listIdLt=None, listIdGte=None, page=1, pageSize=10, raiseError=True, **kwargs)[source]
Get lists. Optional you can set, that lists must belong to account.
- Parameters:
userData (
UnionType[str,None]) – user data, part of user data, case sensitiveuserDataEq (
UnionType[str,None]) – user data, case sensitivecreateTimeLt (
UnionType[str,None]) – upper bound of list create timecreateTimeGte (
UnionType[str,None]) – lower bound of list create time including boundarylastUpdateTimeLt (
UnionType[str,None]) – upper bound of list last update timelastUpdateTimeGte (
UnionType[str,None]) – lower bound of list last update time including boundarylistIdLt (
UnionType[str,None]) – upper bound of list idlistIdGte (
UnionType[str,None]) – lower bound of list id including boundarylistIds (
UnionType[list[str],None]) – list idspage (
UnionType[int,None]) – page, default 1pageSize (
UnionType[int,None]) – page size, default 10raiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with lists will be returned.
- Return type:
class
- getListsCount(userData=None, userDataEq=None, createTimeLt=None, createTimeGte=None, lastUpdateTimeLt=None, lastUpdateTimeGte=None, listIds=None, listIdLt=None, listIdGte=None, raiseError=True, **kwargs)[source]
Get number of lists. Optional you can set, that lists must belong to account.
- Parameters:
userData (
UnionType[str,None]) – user data, part of user data, case sensitiveuserDataEq (
UnionType[str,None]) – user datacreateTimeLt (
UnionType[str,None]) – upper bound of list create timecreateTimeGte (
UnionType[str,None]) – lower bound of list create time including boundarylastUpdateTimeLt (
UnionType[str,None]) – upper bound of list last update timelastUpdateTimeGte (
UnionType[str,None]) – lower bound of list last update time including boundarylistIds (
UnionType[list[str],None]) – list idslistIdLt (
UnionType[str,None]) – upper bound of list idlistIdGte (
UnionType[str,None]) – lower bound of list id including boundaryraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with number of lists will be returned.
- Return type:
class
- headAttribute(attributeId, raiseError=True, **kwargs)[source]
Check attributes with attribute id exists.
- Parameters:
attributeId (
str) – attribute idraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse will return json with version.
- Return type:
class
- headFace(faceId, raiseError=True, **kwargs)[source]
Check face existence by id. Optional you can set, that face must belong to account.
- Parameters:
faceId (
str) – face idraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse.
- Return type:
class
- headList(listId, raiseError=True, **kwargs)[source]
Check list existence. Optional you can set, that list must belong to account.
- Parameters:
listId (
str) – list idraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse.
- Return type:
class
- linkFacesToList(listId, faceIds, raiseError=True, **kwargs)[source]
Attach faces to list.
- Parameters:
listId (
str) – list idfaceIds (
list[str]) – face idsraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse.
- Return type:
class
- patchFace(faceId, eventId=None, userData=None, externalId=None, avatar=None, raiseError=True, **kwargs)[source]
Update face. You can update event id, user data, attribute id. Optional you can set, that face must belong to account.
- Parameters:
faceId (
str) – face ideventId (
UnionType[str,None]) – new event idexternalId (
UnionType[str,None]) – external id of the face, if it has its own mapping in the systemuserData (
UnionType[str,None]) – new user dataavatar (
UnionType[str,None]) – face avatar urlraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse.
- Return type:
class
- patchList(listId, userData, raiseError=True, **kwargs)[source]
Update user data of list. Optional you can set, that list must belong to account.
- Parameters:
listId (
str) – list iduserData (
str) – new user dataraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse.
- Return type:
class
- putAttribute(attributeId, basicAttributes=None, descriptors=None, descriptorSamples=None, basicAttributesSamples=None, xpk=None, ttl=None, force=None, raiseError=True, **kwargs)[source]
Put attribute by id. Notice that XPK argument overwrites basic attributes and descriptors above.
- Parameters:
attributeId (
str) – attribute iddescriptors (
UnionType[list[UnionType[bytes,RawDescriptor]],None]) – list of descriptors different versionsdescriptorSamples (
list[str]) – list of warp image id from which the attribute was extracted.basicAttributes (
UnionType[dict,None]) – dict with basic attributes (age, gender, ethnicity)basicAttributesSamples (
list[str]) – list of warp image id from which the basic attribute was extracted.xpk (
bytes) – SDKObject bytes to load attributes fromttl (
UnionType[int,None]) – temporary attribute ttlforce (
UnionType[int,None]) – replace or not existence attributeraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse will return json with version.
- Return type:
class
- putFace(faceId, externalId=None, attributeId=None, basicAttributes=None, descriptors=None, descriptorSamples=None, basicAttributesSamples=None, eventId=None, userData='', avatar=None, listIds=None, raiseError=True, **kwargs)[source]
Put face in luna-faces
- Parameters:
faceId (
str) – external face idexternalId (
UnionType[str,None]) – external id of the face, if it has its own mapping in the systemattributeId (
UnionType[str,None]) – attribute iddescriptors (
UnionType[list[UnionType[bytes,RawDescriptor]],None]) – list of descriptors different versionsdescriptorSamples (
list[str]) – list of warp image id from which the attribute was extracted.basicAttributes (
UnionType[dict,None]) – dict with basic attributes (age, gender, ethnicity)basicAttributesSamples (
list[str]) – list of warp image id from which the basic attribute was extracted.eventId (
UnionType[str,None]) – reference to event which created faceuserData (
UnionType[str,None]) – face user dataavatar (
UnionType[str,None]) – face avatar urllistIds (
UnionType[list[str],None]) – created face will be attach to these listsraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with face id will be returned.
- Return type:
class
- putFaceAttributes(faceId, attributeId=None, basicAttributes=None, descriptors=None, basicAttributesSamples=None, descriptorSamples=None, raiseError=True, **kwargs)[source]
Put face attributes.
- Parameters:
faceId (
str) – face idattributeId (
UnionType[str,None]) – attribute iddescriptors (
UnionType[list[UnionType[bytes,RawDescriptor]],None]) – list of descriptors different versionsdescriptorSamples (
list[str]) – list of warp image id from which the attribute was extracted.basicAttributes (
UnionType[dict,None]) – dict with basic attributes (age, gender, ethnicity)basicAttributesSamples (
list[str]) – list of warp image id from which the basic attribute was extracted.raiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse
- Return type:
class
- unlinkFacesFromList(listId, faceIds, raiseError=True, **kwargs)[source]
Detach faces to list.
- Parameters:
listId (
str) – list idfaceIds (
list[str]) – face idsraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse.
- Return type:
class
- updateFaceAttributes(faceId, attributeId=None, basicAttributes=None, descriptors=None, basicAttributesSamples=None, descriptorSamples=None, raiseError=True, **kwargs)[source]
Update face attributes.
- Parameters:
faceId (
str) – face idattributeId (
UnionType[str,None]) – attribute iddescriptors (
UnionType[list[UnionType[bytes,RawDescriptor]],None]) – list of descriptors different versionsdescriptorSamples (
list[str]) – list of warp image id from which the attribute was extracted.basicAttributes (
UnionType[dict,None]) – dict with basic attributes (age, gender, ethnicity)basicAttributesSamples (
list[str]) – list of warp image id from which the basic attribute was extracted.raiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse
- Return type:
class
Luna Image Store client
The luna-image-store client which allows to create/get/delete images and objects
Module contains luna-image-store client adapted for usage in lambda
- class luna_lambda_tools.public.clients.lis.LIS(lisClient, accountId, bucket)[source]
Luna-image-store client
- deleteImage(imageId, raiseError=True, **kwargs)[source]
Delete image from bucket.
- Parameters:
imageId (
str) – image id to deleteraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse will return json with version.
- Return type:
class
- deleteImages(imageIds, raiseError=True, **kwargs)[source]
Delete images from bucket.
- Parameters:
imageIds (
list[str]) – images ids to deleteraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse will return json with version.
- Return type:
class
- deleteObject(objectId, raiseError=True, **kwargs)[source]
Delete object from bucket.
- Parameters:
objectId (
str) – object idraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse will return json with version.
- Return type:
class
- deleteObjects(objectIds, raiseError=True, **kwargs)[source]
Delete objects from bucket.
- Parameters:
objectIds (
list[str]) – objects ids to deleteraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse will return json with version.
- Return type:
class
- getImage(imageId, withMeta=None, raiseError=True, **kwargs)[source]
Get image from bucket.
- Parameters:
imageId (
str) – external image idwithMeta (
bool) – whether to retrieve user-defined image metadataraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse will return json with version.
- Return type:
class
- getObject(objectId, raiseError=True, **kwargs)[source]
Get object from bucket.
- Parameters:
objectId (
str) – object idraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse will return json with version.
- Return type:
class
- headImage(imageId, withMeta=None, raiseError=True, **kwargs)[source]
Check image existence in bucket.
- Parameters:
imageId (
str) – external image idwithMeta (
bool) – whether to retrieve user-defined image metadataraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse will return json with version.
- Return type:
class
- headObject(objectId, raiseError=True, **kwargs)[source]
Check object existence in bucket.
- Parameters:
objectId (
str) – object idraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse will return json with version.
- Return type:
class
- postImage(imageInBytes, contentType='image/jpeg', raiseError=True, **kwargs)[source]
Post an image to bucket.
- Parameters:
imageInBytes (
UnionType[bytes,bytearray]) – byte’s array (image)contentType (
str) – content-type of image or image/jpeg for defaultraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse will return json with version.
- Return type:
class
- postObject(objectBody, contentType='application/json', raiseError=True, **kwargs)[source]
Post object to bucket.
- Parameters:
objectBody (
str) – object, available: text, jsoncontentType (
str) – content-type of object or application/json for defaultraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse will return json with version.
- Return type:
class
- putImage(imageInBytes, imageId, contentType='image/jpeg', raiseError=True, **kwargs)[source]
Put an image to bucket.
- Parameters:
imageInBytes (
UnionType[bytes,bytearray]) – byte’s array (image)imageId (
str) – image idcontentType (
str) – content-type of image or image/jpeg for defaultraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse will return json with version.
- Return type:
class
- putObject(objectBody, objectId, contentType='application/json', raiseError=True, **kwargs)[source]
Put object to bucket.
- Parameters:
objectBody (
str) – object, available: text, jsonobjectId (
str) – object idcontentType (
UnionType[str,None]) – content-type of object or application/json for defaultraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse will return json with version.
- Return type:
class
Luna Python Matcher client
The luna-python-matcher client which allows to match/crossmatch faces/bodies
Module contains luna-python-matcher client adapted for usage in lambda
- class luna_lambda_tools.public.clients.lpm.LPM(lpmClient, accountId)[source]
Luna-python-matcher client
- crossmatchBodies(candidateFilters, referenceFilters, limit=None, threshold=None, sorting=None, raiseError=True, **kwargs)[source]
Cross Matcher API allows to submit tasks to a service that searches for events by given filters and matches them with each other. Resource implements body descriptors matching.
- Parameters:
candidateFilters (
EventFilters) – candidate events filtersreferenceFilters (
EventFilters) – reference events filterslimit (
UnionType[int,None]) – matching limitthreshold (
UnionType[int,None]) – matching thresholdsorting (
UnionType[int,None]) – whether to sort match resultsraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse: results of matching (failed and succeeded matches)
- Return type:
class
- crossmatchFaces(candidateFilters, referenceFilters, limit=None, threshold=None, sorting=None, raiseError=True, **kwargs)[source]
Cross Matcher API allows to submit tasks to a service that searches for faces/events by given filters and matches them with each other. Resource implements face descriptors matching.
- Parameters:
candidateFilters (
UnionType[FaceFilters,EventFilters,AttributeFilters]) – candidate filtersreferenceFilters (
UnionType[FaceFilters,EventFilters,AttributeFilters]) – reference filterslimit (
UnionType[int,None]) – matching limitthreshold (
UnionType[int,None]) – matching thresholdsorting (
UnionType[int,None]) – whether to sort match resultsraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse: results of matching (failed and succeeded matches)
- Return type:
class
- matchBodies(candidates, references, raiseError=True, **kwargs)[source]
Matcher API allows to submit tasks to a service that searches for faces similar to a given reference(s) by matching them. An attribute descriptor should be extracted for reference(s) and candidate(s). A source for references are events, attributes and faces. A source for candidates are faces and lists.
- Parameters:
candidates (
list[Candidates]) – Candidates object with info about candidates (possible type variants: events)references (
list[UnionType[Reference,BinaryReference]]) – list of Reference objects. Each object has entity id and it type (possible type variants: events, raw descriptors)raiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse: results of matching (failed and succeeded matches)
- Return type:
class
- matchFaces(candidates, references, raiseError=True, **kwargs)[source]
Matcher API allows to submit tasks to a service that searches for faces similar to a given reference(s) by matching them. An attribute descriptor should be extracted for reference(s) and candidate(s). A source for references are events, attributes and faces. A source for candidates are faces and lists.
- Parameters:
candidates (
list[Candidates]) – Candidates object with info about candidatesreferences (
list[UnionType[Reference,BinaryReference]]) – list of Reference objects. Each object has entity id and it type (possible type variants: events, attributes, faces, raw descriptors)raiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse: results of matching (failed and succeeded matches)
- Return type:
class
- matchRaw(candidates, references, raiseError=True, **kwargs)[source]
Matcher raw API allows to match each candidate with each reference descriptors.
- Parameters:
candidates (
list[BinaryReference]) – list of BinaryReference objects for candidatesreferences (
list[BinaryReference]) – list of BinaryReference objects for referencesraiseError – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse: results of matching for each reference
- Return type:
class
Luna Remote SDK client
The luna-remote-sdk client which allows to detect faces/bodies on images, extract descriptors and estimate several parameters
Module contains luna-remote-sdk client adapted for usage in lambda
- class luna_lambda_tools.public.clients.lrs.LRS(lrsClient, accountId)[source]
Luna-remote-sdk client
- sdk(inputData, multifacePolicy=1, detectFace=None, detectBody=None, estimateHeadPose=None, estimateLandmarks68=None, estimateLandmarks5=None, estimateQuality=None, estimateGaze=None, estimateEyesAttributes=None, estimateEmotions=None, estimateMouthAttributes=None, estimateMask=None, estimateGlasses=None, estimateLiveness=None, estimateFaceWarp=None, estimateBodyWarp=None, aggregateAttributes=None, estimateBasicAttributes=None, estimateBodyDescriptor=None, estimateFaceDescriptor=None, estimateUpperBody=None, estimateLowerBody=None, estimateBodyBasicAttributes=None, estimateAccessories=None, pitchThreshold=None, rollThreshold=None, yawThreshold=None, scoreThreshold=None, maskStates=None, livenessStates=None, imageType=None, useExifInfo=None, extractExif=None, raiseError=True, **kwargs)[source]
Detect faces on input images.
- Parameters:
inputData (
UnionType[BinaryImage,list[BinaryImage],list[UrlForDetection],list[str]]) – one of: - Single image or images list for extraction (supported formats “jpeg, png, tif, ppm, bmp”). - list of urls with images - list of images’ idsmultifacePolicy (
int) – multiple face detection policy: 0 - multiple face detection not allowed, 1 - multiple face detection allowed, 2 - get best detection from the imagedetectFace (
UnionType[int,None]) – detect facesdetectBody (
UnionType[int,None]) – detect human bodiesestimateHeadPose (
UnionType[int,None]) – Available values : 0, 1estimateLandmarks5 (
UnionType[int,None]) – Available values : 0, 1estimateLandmarks68 (
UnionType[int,None]) – Available values : 0, 1estimateQuality (
UnionType[int,None]) – Available values : 0, 1estimateGaze (
UnionType[int,None]) – Available values : 0, 1estimateEyesAttributes (
UnionType[int,None]) – Available values : 0, 1estimateMouthAttributes (
UnionType[int,None]) – Available values : 0, 1estimateEmotions (
UnionType[int,None]) – Available values : 0, 1estimateMask (
UnionType[int,None]) – Available values: 0, 1estimateGlasses (
UnionType[int,None]) – Available values: 0, 1estimateLiveness (
UnionType[int,None]) – Available values: 0, 1estimateFaceDescriptor (
UnionType[int,None]) – Available values : 0, 1estimateBodyDescriptor (
UnionType[int,None]) – Available values : 0, 1estimateBasicAttributes (
UnionType[int,None]) – Available values : 0, 1estimateBodyWarp (
UnionType[int,None]) – Available values : 0, 1estimateFaceWarp (
UnionType[int,None]) – Available values : 0, 1estimateUpperBody (
UnionType[int,None]) – Available values : 0, 1estimateLowerBody (
UnionType[int,None]) – Available values : 0, 1estimateBodyBasicAttributes (
UnionType[int,None]) – Available values : 0, 1estimateAccessories (
UnionType[int,None]) – Available values : 0, 1pitchThreshold (
UnionType[int,None]) – maximum deviation pitch angle from 0rollThreshold (
UnionType[int,None]) – maximum deviation roll angle from 0yawThreshold (
UnionType[int,None]) – maximum deviation yaw angle from 0scoreThreshold (
float) – descriptor garbage scoremaskStates (
UnionType[list[int],None]) – Array of integer (filter by mask state) (Items Enum:1 2 3)livenessStates (
UnionType[list[int],None]) – Array of integer (filter by liveness state) (Items Enum:0 1 2)aggregateAttributes (
UnionType[int,None]) – Available values : 0, 1imageType (
UnionType[int,None]) – image type (0 - raw image, 1 - face warped image, 2 - body warped image)useExifInfo (
UnionType[int,None]) – whether to use exif info for auto orientationextractExif (
UnionType[int,None]) – extract EXIF meta information from imagesraiseError (
bool) – whether to raise LunaApiException in case of failure
- Returns:
~.LunaResponse or asyncio coroutine with LunaResponse. In body of :class: ~.LunaResponse json with samples, exif, filename for succeeded images and errors for failed images will be returned.
- Return type:
class
Luna Sender client
The luna-sender client which allows to send custom events to luna-sender
Module contains luna-sender client adapted for usage in lambda
- class luna_lambda_tools.public.clients.sender.Sender(senderClient, accountId)[source]
Luna-sender client
- publish(events, *, handlerId, eventCreateTime, eventEndTime, raiseError=True, **kwargs)[source]
Publish user generated events. :type events:
list[dict] :param events: user generated events to be published :type handlerId:str:param handlerId: event handler id :type eventCreateTime:str:param eventCreateTime: event creation time :type eventEndTime:str:param eventEndTime: event end time :param raiseError: whether to raise LunaApiException in case of failure