Methods reference
27 minute read
datavision_beeyard_sdk package
A client library for accessing Hive API.
This SDK is used to interact with the BeeYard platform.
Classes and Modules
- AuthenticatedClient
Is the class used to authenticate the user on the BeeYard platform.
- helpers
Module containing helper methods.
- api
Module that contains methods for accessing the BeeYard APIs.
- models
Module that contains all the data models used in inputs/outputs.
- types
Module that defines useful custom types to interact with BeeYard, like File or Response.
- exceptions
Class for error handling in shape manipulation.
Examples
>>> from datavision_beeyard_sdk import AuthenticatedClient
>>> from datavision_beeyard_sdk.api.license import get_license
>>> client = AuthenticatedClient("http://localhost:8018/hive/", "tester", "foobar")
>>> get_license.read_license_info(client=client)
{'isValid': True, 'licenseType': 'Subscription', 'created': '2023-02-02T14:13:00.401Z',
'expiry': '2024-02-01T00:00:00Z', 'maxUsers': 5, 'maxMachines': 5}
Client class
- class datavision_beeyard_sdk.client.AuthenticatedClient(base_url, username='', password='', grant_type='password', max_waiting_time_ms=0, client_id='byard', client_secret='', login_url=None, use_token=False, token=None)
Bases:
object
BeeYard client.
This class can be initialized in multiple ways, depending on the login type the user wants to perform.
- Parameters:
base_url (str) – The url to the Hive.
username (str, optional) – Used if the grant_type is
password
.password (str, optional) – Used if the grant_type is
password
.grant_type ({'password', 'client_credentials'}) – Type of login to perform, by default “password”.
max_waiting_time_ms (int, optional) – Waiting time between subsequent calls, by default 0.
client_id (str, optional) – Used if the grant_type is
client_credentials
.client_secret (str, optional) – Used if the grant_type is
client_credentials
.login_url (str, optional) – To be specified if login server is on different domain then Hive, by default None.
use_token (bool, optional) – To be set True if a valid token is used instead of login, by default False., by default False.
token (str or dict, optional) – Valid token, by default None.
- token_headers
Is initialized by the constructor. It contains the valid token to be used to communicate with BeeYard.
- Type:
dict
Examples
>>> client = AuthenticatedClient("http://localhost:8018/hive/", "tester", "foobar")
>>> # Using client credentials >>> client = AuthenticatedClient( >>> "http://localhost:8018/hive/", >>> grant_type="client_credentials", >>> client_id="public.app", >>> client_secret="barfoo", >>> login_url="http://localhost:8018/id/", >>>)
>>> #Using valid access token >>> client = AuthenticatedClient( >>> "http://localhost:8018/hive/", >>> use_token=True, >>> token=valid_token, >>>)
- authenticate()
Authenticate the client.
- Returns:
Returns true if authentication is performed successfully.
- Return type:
bool
- Raises:
Exception – If grant_type is not recognized.
Exception – If authentication fails.
- check_response(response)
Check status response from API.
- Parameters:
response (Response) – Http response from API.
- Returns:
True if Response status is in range 200-300.
- Return type:
bool
- Raises:
Exception – Bad response if Response status is in range 400-500.
Exception – Bad response if Response status is in range 500-600.
- delete(*args, **kwargs)
Performs HTTP DELETE request.
Tries for
delay
seconds to reconnect in case of connection error. If response status is 401, it tries to re-authenticate the user.- Returns:
Http response from API.
- Return type:
- get(*args, **kwargs)
Performs HTTP GET request.
Tries for
delay
seconds to reconnect in case of connection error. If response status is 401, it tries to re-authenticate the user.- Returns:
Http response from API.
- Return type:
- patch(*args, **kwargs)
Performs HTTP PATCH request.
Tries for
delay
seconds to reconnect in case of connection error. If response status is 401, it tries to re-authenticate the user.- Returns:
Http response from API.
- Return type:
- post(*args, **kwargs)
Performs HTTP POST request.
Tries for
delay
seconds to reconnect in case of connection error. If response status is 401, it tries to re-authenticate the user.- Returns:
Http response from API.
- Return type:
Types module
Contains some shared types for properties
- class datavision_beeyard_sdk.types.File(payload: BinaryIO | TextIO, file_name: str | None = None, mime_type: str | None = None)
Bases:
object
Contains information for file uploads
Examples
>>> # Create a new image >>> im = Image.new("RGB", (300, 200), color="green") >>> tmp = io.BytesIO() >>> im.save(tmp, format="png") >>> data = tmp.getvalue() >>> im.close() >>> # Create the payload to be sent >>> f = File(payload=data, file_name="test.png", mime_type="image/png")
Exceptions class
Helpers module
Module containing BeeYard helper functions.
Module that contains helper functions to simplify some operations
like downloading images or extract specific shapes from BeeYard.
The classes and methods of this module can be imported with from datavision_beeyard_sdk.helpers import *
.
Functions and Classes
Shape
Cross
Rectangle
OrientedRectangle
Polygon
Ellipse
Circle
Point
get_images()
get_annotations()
add_empty_overlay()
Examples
>>> from datavision_beeyard_sdk.helpers import Cross, Point
>>> Cross("rgba(255, 0, 0, 1)", 1, "testMarker", Point(255.0, 255.0), 0, 50, True)
<datavision_beeyard_sdk.helpers.shapes.Cross object at 0x000002B8A5F0F6A0>
Cells module
- datavision_beeyard_sdk.helpers.cells.add_empty_overlay(client, cell_id, name='empty.shp')
Add an empty overlay.
The name can be specified.
- Parameters:
client (AuthenticatedClient) – BeeYard client.
cell_id (str) – The BeeYard cell id.
name (str, optional) – Name of the empty overlay, by default “empty.shp”
- Returns:
Http response from API.
- Return type:
- datavision_beeyard_sdk.helpers.cells.get_annotations(overlays_json, annotation_type=None)
Get all annotations from an overlay.
This methods get all annotations of a given type from a BeeYard cell. If the type is not specified, then all annotations will be returned.
- Parameters:
overlays_json (json str) – A json string containing the overlay dictionary.
annotation_type (str, optional) – The annotation type to retrive from the overlay, by default None.
- Returns:
List of shapes. Each shape is a dictionary.
- Return type:
list[dict]
- Raises:
Exception – If annotation type is not found in overlay.
- datavision_beeyard_sdk.helpers.cells.get_images(cell_id, client)
Get all images from a cell.
This method will download all images present inside the BeeYard cell.
- Parameters:
cell_id (str) – The BeeYard cell id where images are stored.
client (AuthenticatedClient) – The BeeYard client used to connect to the platform.
- Returns:
The list of images. Each image is byte encoded. The list is empty if no image is present inside the cell.
- Return type:
list[bytes]
Shapes module
- class datavision_beeyard_sdk.helpers.shapes.Circle(strokeColor, strokeWidth, name, location, radius, fillColor, properties=[], id=None)
Bases:
Shape
Circle shape class.
- Parameters:
strokeColor (str) – String describing the color. The string must be a color space tuple e.g. rgba(255, 0, 0, 1).
strokeWidth (float) – Thickness of the shape border.
name (str) – Shape name.
location (Point) – Point object representing the location of the shape in pixels.
radius (float) – Radius.
fillColor (str) – String describing the filling color. The string must be a color space tuple e.g. rgba(255, 0, 0, 1).
properties (list, optional) – Additional properties, by default [].
id (UUID, optional) – Id is automatically generated by BeeYard, by default None.
Examples
>>> c = Circle("rgba(255, 0, 0, 1)", 1, "circleExample", Point(255.0, 255.0), 50, "rgba(255, 0, 0, 1)")
- class datavision_beeyard_sdk.helpers.shapes.Cross(strokeColor, strokeWidth, name, location, rotationDeg, size, zoomInvariant, properties=[], id=None)
Bases:
Shape
Cross shape class.
- Parameters:
strokeColor (str) – String describing the color. The string must be a color space tuple e.g. rgba(255, 0, 0, 1).
strokeWidth (float) – Thickness of the shape border.
name (str) – Shape name.
location (Point) – Point object representing the location of the shape in pixels.
rotationDeg (float) – Rotation in degrees of the cross.
size (float) – Size of the shape.
zoomInvariant (bool) – If the shape has to change size with zooming.
properties (list, optional) – Additional properties, by default [].
id (UUID, optional) – Id is automatically generated by BeeYard, by default None.
Examples
>>> cross = Cross("rgba(255, 0, 0, 1)", 1, "testMarker", Point(255.0, 255.0), 0, 50, True)
- class datavision_beeyard_sdk.helpers.shapes.Ellipse(strokeColor, strokeWidth, name, location, radiusRow, radiusCol, rotationDeg, fillColor, properties=[], id=None)
Bases:
Shape
Ellipse shape class.
- Parameters:
strokeColor (str) – String describing the color. The string must be a color space tuple e.g. rgba(255, 0, 0, 1).
strokeWidth (float) – Thickness of the shape border.
name (str) – Shape name.
location (Point) – Point object representing the location of the shape in pixels.
radiusRow (float) – y axis radius length in pixels.
radiusCol (float) – x axis radius length in pixels.
rotationDeg (float) – Rotation in degrees of the rectangle.
fillColor (str) – String describing the filling color. The string must be a color space tuple e.g. rgba(255, 0, 0, 1).
properties (list, optional) – Additional properties, by default [].
id (UUID, optional) – Id is automatically generated by BeeYard, by default None.
Examples
>>> e = Ellipse("rgba(255, 0, 0, 1)", 1, "ellipseExample", Point(255.0, 255.0), 50, 100, 45, "rgba(255, 0, 0, 1)")
- class datavision_beeyard_sdk.helpers.shapes.OrientedRectangle(strokeColor, strokeWidth, name, location, width, height, fillColor, rotationDeg, properties=[], id=None)
Bases:
Rectangle
Oriented rectangle shape class.
- Parameters:
strokeColor (str) – String describing the color. The string must be a color space tuple e.g. rgba(255, 0, 0, 1).
strokeWidth (float) – Thickness of the shape border.
name (str) – Shape name.
location (Point) – Point object representing the location of the shape in pixels.
width (float) – Width of the rectangle.
height (float) – Height of the rectangle.
fillColor (str) – String describing the filling color. The string must be a color space tuple e.g. rgba(255, 0, 0, 1).
rotationDeg (float) – Rotation in degrees of the rectangle.
properties (list, optional) – Additional properties, by default [].
id (UUID, optional) – Id is automatically generated by BeeYard, by default None.
Examples
>>> oriented_rectangle = OrientedRectangle("rgba(255, 0, 0, 1)", 1, "orientedRectangleExample", Point(255.0, 255.0), 50, 50, "rgba(255, 0, 0, 1)", 45.0)
- class datavision_beeyard_sdk.helpers.shapes.Point(row, col)
Bases:
object
Point class.
- class datavision_beeyard_sdk.helpers.shapes.Polygon(strokeColor, strokeWidth, name, vertices, fillColor, properties=[], id=None)
Bases:
Shape
Polygon shape class.
- Parameters:
strokeColor (str) – String describing the color. The string must be a color space tuple e.g. rgba(255, 0, 0, 1).
strokeWidth (float) – Thickness of the shape border.
name (str) – Shape name.
vertices (list[Point]) – List of Point objects representing the location of the polygon vertices in pixels.
fillColor (str) – String describing the filling color. The string must be a color space tuple e.g. rgba(255, 0, 0, 1).
properties (list, optional) – Additional properties, by default [].
id (UUID, optional) – Id is automatically generated by BeeYard, by default None.
Examples
>>> polygon = Polygon("rgba(255, 0, 0, 1)", 1, "polygonExample", [Point(255.0, 255.0), Point(300.0, 310.0)], "rgba(255, 0, 0, 1)")
- class datavision_beeyard_sdk.helpers.shapes.Rectangle(strokeColor, strokeWidth, name, location, width, height, fillColor, properties=[], id=None)
Bases:
Shape
Rectangle shape class.
- Parameters:
strokeColor (str) – String describing the color. The string must be a color space tuple e.g. rgba(255, 0, 0, 1).
strokeWidth (float) – Thickness of the shape border.
name (str) – Shape name.
location (Point) – Point object representing the location of the shape in pixels.
width (float) – Width of the rectangle.
height (float) – Height of the rectangle.
fillColor (str) – String describing the filling color. The string must be a color space tuple e.g. rgba(255, 0, 0, 1).
properties (list, optional) – Additional properties, by default [].
id (UUID, optional) – Id is automatically generated by BeeYard, by default None.
Examples
>>> rect = Rectangle("rgba(255, 0, 0, 1)", 1, "testMarker", Point(255.0, 255.0), 100, 200, "rgba(255, 0, 0, 1)")
- class datavision_beeyard_sdk.helpers.shapes.Shape(strokeColor, strokeWidth, name, properties=[], id=None)
Bases:
object
Base class for BeeYard shapes.
- Parameters:
strokeColor (str) – String describing the color. The string must be a color space tuple e.g. rgba(255, 0, 0, 1).
strokeWidth (float) – Thickness of the shape border.
name (str) – Name of the shape.
properties (list, optional) – Additional properties, by default [].
id (UUID, optional) – ID is automatically generated by BeeYard, by default None.
- create()
Create dictionary from shape.
- Returns:
Returns the shape in the form of a dictionary.
- Return type:
dict
- classmethod read_from_beeyard(cell_id, overlay_name, sh_id, client)
Read a shape from BeeYard.
- Parameters:
cell_id (str) – Target cell in BeeYard.
overlay_name (str) – Target overlay.
sh_id (str) – Id of the target shape.
client (AuthenticatedClient) – BeeYard client.
- Returns:
Return the BeeYard shape as instance of Shape class.
- Return type:
- upload(cell_id, overlay_name, layer_name, client)
Upload to BeeYard.
- Parameters:
cell_id (str) – Id of the cell where the shape should be uploaded.
overlay_name (str) – The target overlay.
layer_name (str) – The target layer.
client (AuthenticatedClient) – BeeYard client.
- Returns:
Http response from API.
- Return type:
API module
Module containing methods for accessing the BeeYard APIs.
The methods of this module can be imported with from datavision_beeyard_sdk.api import *
.
Examples
>>> from datavision_beeyard_sdk.api.workspace import read_workspace
>>> ws = read_workspace.read(workspace_id=ws_id, client=client)
>>> json.loads(ws)
{'workspaceId': 'b662e28a-73c4-403f-bdb2-e2930066bf4d', 'name': 'test', 'namespace': 'test',
'created': '2023-08-11T10:34:05.703Z', 'modified': '2023-08-11T10:46:56.247Z', 'version': 8,
'schemaVersion': '1', 'tagTemplates': [{'section': 'anomaly', 'name': 'anomalia'},
{'section': 'class', 'name': 'anomalia'}, {'section': 'class', 'name': 'buone'},
{'section': 'dataset', 'name': 'test'},
{'section': 'task', 'name': 'anomaly_detection'}, {'section': 'util', 'name': 'csv'}],
'shapeTemplates': [], 'favoriteQueries': [], 'favoriteAggregations': [], 'tagCategoryRules': []}
Cell package
Interact with cells
add_properties
- datavision_beeyard_sdk.api.cell.add_properties.add(id: str, *, client: ~datavision_beeyard_sdk.client.AuthenticatedClient, props_list: [<class 'datavision_beeyard_sdk.models.property_dto.PropertyDto'>])
Add properties to cell.
- Parameters:
id (str) – Target cell id.
client (AuthenticatedClient) – BeeYard client.
props_list (list[PropertyDto]) – List of properties.
- Returns:
Http response from API.
- Return type:
add_references
- datavision_beeyard_sdk.api.cell.add_references.add(id: str, *, client: ~datavision_beeyard_sdk.client.AuthenticatedClient, ref_list: [<class 'datavision_beeyard_sdk.models.reference_dto.ReferenceDto'>])
Add references to cell.
- Parameters:
id (str) – Target cell id.
client (AuthenticatedClient) – BeeYard client.
ref_list (list[ReferenceDto]) – List of references.
- Returns:
Http response from API.
- Return type:
aggregate_cells
- datavision_beeyard_sdk.api.cell.aggregate_cells.query(*, client: AuthenticatedClient, accept: str = 'application/json', query='[]')
Perform aggregation of existing cells.
- Parameters:
client (AuthenticatedClient) – BeeYard client.
accept (str, optional) – mime type, by default “application/json”
query (str, optional) – BeeYard query, by default “[]”
- Returns:
Content of the Http response from API as a json.
- Return type:
json string
create_cell
- datavision_beeyard_sdk.api.cell.create_cell.create(client, namespace=None, additional_tags=None, additional_properties=None)
_summary_
- Parameters:
client (AuthenticatedClient) – BeeYard client.
namespace (str, optional) – Target namespace, by default None.
additional_tags (list[dict], optional) – Dictionary containing tags, by default None.
additional_properties (dict, optional) – Dictionary containing properties, by default None.
- Returns:
Dictionary describing the cell.
- Return type:
dict
Examples
>>> # Tags or properties should be sent as lists: >>> additional_tags = [ >>> {"beeyard_sdk_test.section_name": "test_name1"}, >>> {"beeyard_sdk_test.section_name": "test_name2"}, >>> ] >>> additional_tags={"key1": "value1", "key2": "value2"}
list_referenced_cells
- datavision_beeyard_sdk.api.cell.list_referenced_cells.search(id: str, *, client: AuthenticatedClient)
List referenced cells.
- Parameters:
id (str) – Id of the target cell.
client (AuthenticatedClient) – BeeYard client.
- Returns:
Dictionary containing the references.
- Return type:
dict
modify_cell_description
- datavision_beeyard_sdk.api.cell.modify_cell_description.update_description(id: str, *, client: AuthenticatedClient, description: ModifyCellInputDto)
Modify cell description.
- Parameters:
id (str) – Id of the target cell.
client (AuthenticatedClient) – BeeYard client.
description (ModifyCellInputDto) – Cell description.
- Returns:
Http response from API.
- Return type:
modify_property
- datavision_beeyard_sdk.api.cell.modify_property.update(id: str, *, client: AuthenticatedClient, prop_update: PropertyDto)
Modify cell property
- Parameters:
id (str) – Id of the target cell.
client (AuthenticatedClient) – BeeYard client.
prop_update (PropertyDto) – Cell property.
- Returns:
Http response from API.
- Return type:
read_cell
- datavision_beeyard_sdk.api.cell.read_cell.read(id: str, *, client: AuthenticatedClient)
Read cell.
- Parameters:
id (str) – Id of the target cell.
client (AuthenticatedClient) – BeeYard client.
- Returns:
Dictionary describing the cell.
- Return type:
dict
remove_cell
- datavision_beeyard_sdk.api.cell.remove_cell.remove(id: str, *, client: AuthenticatedClient, namespace=None)
Remove cell.
- Parameters:
id (str) – Id of the target cell.
client (AuthenticatedClient) – BeeYard client.
namespace (str, optional) – Namespace of the cell to remove, by default None
- Returns:
Http response from API.
- Return type:
remove_properties
- datavision_beeyard_sdk.api.cell.remove_properties.delete(id: str, *, client: ~datavision_beeyard_sdk.client.AuthenticatedClient, keys: [<class 'str'>])
Remove properties from cell.
- Parameters:
id (str) – Id of the target cell.
client (AuthenticatedClient) – BeeYard client.
keys (list[str]) – List of keys of the properties to be removed.
- Returns:
Http response from API.
- Return type:
remove_references
- datavision_beeyard_sdk.api.cell.remove_references.delete(id: str, *, client: ~datavision_beeyard_sdk.client.AuthenticatedClient, keys: [<class 'str'>])
Remove references from cell.
- Parameters:
id (str) – Id of the target cell.
client (AuthenticatedClient) – BeeYard client.
keys (list[str]) – List of keys of the references to be removed.
- Returns:
Http response from API.
- Return type:
search_cells
- datavision_beeyard_sdk.api.cell.search_cells.query(*, client: AuthenticatedClient, query='', sort_by='created', sort_direction='desc', namespace='', page_index=0, page_size=100)
Query existing cells.
- Parameters:
client (AuthenticatedClient) – BeeYard client.
query (str, optional) – MongoDB query, by default “”.
sort_by ({'created', 'uploaded', 'modified'}, optional) – Sort results, by default “created”.
sort_direction ({'asc', 'desc'}, optional) – Sort results order, by default “asc”
namespace (str, optional) – Search cells in specific namespace, by default all namespaces are searched.
page_index (int, optional) – Return results from index page, by default 0.
page_size (int, optional) – Number of cells per page, by default 100.
- Returns:
Results of the query.
- Return type:
dict
upload_cell
- datavision_beeyard_sdk.api.cell.upload_cell.upload(*, client: AuthenticatedClient, files: UploadCellMultipartData, tags: dict | None = None, properties: dict | None = None)
Upload cell to BeeYard.
- Parameters:
client (AuthenticatedClient) – BeeYard client.
files (UploadCellMultipartData) – Object containing list of files containing cells to be uploaded.
tags (list[dict], optional) – List of dictionaries, each containing tags, by default None.
properties (dict, optional) – Dictionary containing properties, by default None.
- Returns:
Http response from API.
- Return type:
Examples
>>> # Tags or properties should be sent as lists: >>> additional_tags = [ >>> {"beeyard_sdk_test.section_name": "test_name1"}, >>> {"beeyard_sdk_test.section_name": "test_name2"}, >>> ] >>> additional_tags={"key1": "value1", "key2": "value2"}
Document package
Interact with documents
add_documents
- datavision_beeyard_sdk.api.document.add_documents.add(id: str, *, client: AuthenticatedClient, multipart_data: AddDocumentsMultipartData)
Add documents to cell.
- Parameters:
id (str) – Id of the target cell.
client (AuthenticatedClient) – BeeYard client.
multipart_data (AddDocumentsMultipartData) – Object containing list of documents to be uploaded.
- Returns:
Http response from API.
- Return type:
modify_document
Event package
Interact with events
aggregate_events
- datavision_beeyard_sdk.api.event.aggregate_events.query(*, client: AuthenticatedClient, accept: str = 'application/json', query='[]')
Aggregate events.
- Parameters:
client (AuthenticatedClient) – BeeYard client.
accept (str, optional) – mime type, by default “application/json”.
query (str, optional) – MongoDB query, by default “[]”
- Returns:
Content of the Http response from API as a json.
- Return type:
json string
read_event
- datavision_beeyard_sdk.api.event.read_event.read(*, client: AuthenticatedClient, event_id: str)
Read events.
- Parameters:
client (AuthenticatedClient) – BeeYard client.
event_id (str) –
- Returns:
Content of the Http response from API as a json.
- Return type:
json string
search_events
- datavision_beeyard_sdk.api.event.search_events.query(*, client: AuthenticatedClient, query='', sort_by='created', sort_direction='desc', page_index=0, page_size=100)
File package
Interact with files
file.add_files
- datavision_beeyard_sdk.api.file.add_files.add(id: str, *, client: AuthenticatedClient, files: AddFilesMultipartData)
Add files to cell.
- Parameters:
id (str) – Id of the target cell.
client (AuthenticatedClient) – BeeYard client.
files (AddFilesMultipartData) – Object containing list of files to upload.
- Returns:
Http response from API.
- Return type:
file.add_properties
- datavision_beeyard_sdk.api.file.add_properties.add(id: str, filename: str, *, client: ~datavision_beeyard_sdk.client.AuthenticatedClient, props_list: [<class 'datavision_beeyard_sdk.models.property_dto.PropertyDto'>])
Add properties to file.
- Parameters:
id (str) – Target cell id.
filename (str) –
client (AuthenticatedClient) – BeeYard client.
props_list (list[PropertyDto]) – List of properties.
- Returns:
Http response from API.
- Return type:
file.modify_file
- datavision_beeyard_sdk.api.file.modify_file.update(*, id: str, client: AuthenticatedClient, filename: str, json_body: str)
Modify file.
- Parameters:
id (str) – Id of the target cell.
client (AuthenticatedClient) – BeeYard client.
filename (str) –
json_body (json str) – New file content
- Returns:
Http response from API.
- Return type:
file.modify_property
- datavision_beeyard_sdk.api.file.modify_property.update(id: str, filename: str, *, client: AuthenticatedClient, prop_update: PropertyDto)
Modify file property
- Parameters:
id (str) – Id of the target cell.
filename (str) –
client (AuthenticatedClient) – BeeYard client.
prop_update (PropertyDto) – Object containing the old property and the new one.
- Returns:
Http response from API.
- Return type:
file.read_file
- datavision_beeyard_sdk.api.file.read_file.read(id: str, filename: str, *, client: AuthenticatedClient)
Read file from cell.
- Parameters:
id (str) – Id of the target cell.
filename (str) –
client (AuthenticatedClient) – BeeYard client.
- Returns:
Content of the Http response from API as a json.
- Return type:
json string
file.remove_files
- datavision_beeyard_sdk.api.file.remove_files.remove(id: str, *, client: ~datavision_beeyard_sdk.client.AuthenticatedClient, filenames: [<class 'str'>])
Remove files.
- Parameters:
id (str) – Id of the target cell.
client (AuthenticatedClient) – BeeYard client.
filenames (list[str]) – List of file names.
- Returns:
Http response from API.
- Return type:
file.remove_properties
- datavision_beeyard_sdk.api.file.remove_properties.delete(id: str, filename: str, *, client: ~datavision_beeyard_sdk.client.AuthenticatedClient, keys: [<class 'str'>])
Remove properties from file.
- Parameters:
id (str) – Target cell id.
filename (str) –
client (AuthenticatedClient) – BeeYard client.
keys (list[str]) – List of property keys to be removed.
- Returns:
Http response from API.
- Return type:
Health package
Check BeeYard status
get_liveness
- datavision_beeyard_sdk.api.health.get_liveness.live(*, client: AuthenticatedClient)
Get liveness.
- Parameters:
client (AuthenticatedClient) – BeeYard client.
- Returns:
Liveness status.
- Return type:
str
get_readiness
- datavision_beeyard_sdk.api.health.get_readiness.ready(*, client: AuthenticatedClient)
Get readiness.
- Parameters:
client (AuthenticatedClient) – BeeYard client.
- Returns:
Liveness status.
- Return type:
str
Image package
Interact with images
add_images
- datavision_beeyard_sdk.api.image.add_images.add(id: str, *, client: AuthenticatedClient, multipart_data: AddImagesMultipartData)
Add images in cell.
- Parameters:
id (str) – Id of the target cell.
client (AuthenticatedClient) – BeeYard client.
multipart_data (AddImagesMultipartData) – Object containing list of images to be added.
- Returns:
Http response from API.
- Return type:
create_image_thumbnail
- datavision_beeyard_sdk.api.image.create_image_thumbnail.create(id: str, *, client: AuthenticatedClient, image_name: str)
Create image thumbnail.
- Parameters:
id (str) – Id of the target cell.
client (AuthenticatedClient) – BeeYard client.
image_name (str) –
- Returns:
Http response from API.
- Return type:
read_image_thumbnail
- datavision_beeyard_sdk.api.image.read_image_thumbnail.read(id: str, *, client: AuthenticatedClient, image_name: str)
Read image thumbnail.
- Parameters:
id (str) – Id of the target cell.
client (AuthenticatedClient) – BeeYard client.
image_name (str) –
- Returns:
Bytes stream of the thumbnail.
- Return type:
bytes
upload_image_thumbnail
- datavision_beeyard_sdk.api.image.upload_image_thumbnail.upload(id: str, *, client: AuthenticatedClient, image_name: str, multipart_data: AddImagesMultipartData)
Upload image thumbnail to cell.
- Parameters:
id (str) – Id of the target cell.
client (AuthenticatedClient) – BeeYard client.
image_name (str) –
multipart_data (AddImagesMultipartData) – Thumbnail to be added.
- Returns:
Http response from API.
- Return type:
License package
Interact with license
get_license
- datavision_beeyard_sdk.api.license.get_license.read_license_info(*, client: AuthenticatedClient)
Read license status.
- Parameters:
client (AuthenticatedClient) – BeeYard client.
- Returns:
License status.
- Return type:
dict
Overlay package
Interact with overlays
add_overlays
- datavision_beeyard_sdk.api.overlay.add_overlays.add(id: str, *, client: AuthenticatedClient, multipart_data: AddDocumentsMultipartData)
Add overlays to cell.
- Parameters:
id (str) – Id of the target cell.
client (AuthenticatedClient) – BeeYard client.
multipart_data (AddDocumentsMultipartData) – Object containing list of overlays to be added.
- Returns:
Http response from API.
- Return type:
add_shapes
- datavision_beeyard_sdk.api.overlay.add_shapes.add(id: str, overlay_name: str, layer_name: str, *, client: AuthenticatedClient, shape_list: [])
Add shapes to overlay.
- Parameters:
id (str) – Id of the target cell.
overlay_name (str) – Name of the target overlay.
layer_name (str) – Name of the target layer. If does not exist, it is created.
client (AuthenticatedClient) – BeeYard client.
shape_list (list[dict]) – List of dictionary. Each dictionary is a shape.
- Returns:
Http response from API.
- Return type:
modify_mask
- datavision_beeyard_sdk.api.overlay.modify_mask.update(id: str, overlay_name: str, *, client: AuthenticatedClient, mask_data: UploadMaskMultipartData)
Modify a mask.
- Parameters:
id (str) – Id of the target cell.
overlay_name (str) – Name of target overlay.
client (AuthenticatedClient) – BeeYard client.
mask_data (UploadMaskMultipartData) – New mask data.
- Returns:
Http response from API.
- Return type:
modify_overlay
- datavision_beeyard_sdk.api.overlay.modify_overlay.update(*, id: str, client: AuthenticatedClient, overlay_name: str, shape_to_modify: ModifyOverlayMultipartData)
Modify overlay.
- Parameters:
id (str) – Id of the target cell.
client (AuthenticatedClient) – BeeYard client.
overlay_name (str) – Name of target overlay.
shape_to_modify (ModifyOverlayMultipartData) – New overlay data.
- Returns:
Http response from API.
- Return type:
read_overlays
- datavision_beeyard_sdk.api.overlay.read_overlays.read(id: str, *, client: AuthenticatedClient)
Read overlays from cell.
- Parameters:
id (str) – Id of the target cell.
client (AuthenticatedClient) – BeeYard client.
- Returns:
Content of the Http response from API as a json.
- Return type:
json string
read_shape
- datavision_beeyard_sdk.api.overlay.read_shape.read(id: str, overlay_name: str, shape_id: str, *, client: AuthenticatedClient)
Read a shape from an overlay.
- Parameters:
id (str) – Id of the target cell.
overlay_name (str) – Name of the target overlay.
shape_id (str) – Id of the shape to read.
client (AuthenticatedClient) – BeeYard client.
- Returns:
Content of the Http response from API as a json.
- Return type:
json string
remove_layers
- datavision_beeyard_sdk.api.overlay.remove_layers.remove(id: str, overlay_name: str, *, client: ~datavision_beeyard_sdk.client.AuthenticatedClient, layer_names: [<class 'str'>])
Remove layers from cell.
- Parameters:
id (str) – Id of the target cell.
overlay_name (str) – Name of the target overlay.
client (AuthenticatedClient) – BeeYard client.
layer_names (list[str]) – List of layers to be removed.
- Returns:
Http response from API.
- Return type:
remove_shapes
- datavision_beeyard_sdk.api.overlay.remove_shapes.remove(id: str, overlay_name: str, *, client: ~datavision_beeyard_sdk.client.AuthenticatedClient, shape_ids: [<class 'str'>])
_summary_
- Parameters:
id (str) – Id of the target cell.
overlay_name (str) – Name of the target overlay.
client (AuthenticatedClient) – BeeYard client.
shape_ids (list[str]) – List of shape ids to be removed.
- Returns:
Http response from API.
- Return type:
rename_layer
- datavision_beeyard_sdk.api.overlay.rename_layer.update(id: str, client: AuthenticatedClient, *, overlay_name: str, layer_name: str, json_body: str)
Rename a layer.
- Parameters:
id (str) – Id of the target cell.
client (AuthenticatedClient) – BeeYard client.
overlay_name (str) – Name of the target overlay.
layer_name (str) – Old layer name.
json_body (json str) – Json string with new layer name.
- Returns:
Http response from API.
- Return type:
upload_mask
- datavision_beeyard_sdk.api.overlay.upload_mask.upload(id: str, overlay_name: str, layer_name: str, *, client: AuthenticatedClient, mask_data: UploadMaskMultipartData)
Upload a mask to layer.
- Parameters:
id (str) – Id of the target cell.
overlay_name (str) – Name of the target overlay.
layer_name (str) – Name of the target layer.
client (AuthenticatedClient) – BeeYard client.
mask_data (UploadMaskMultipartData) – Object containing mask data.
- Returns:
Http response from API.
- Return type:
Statistics package
Get relevant BeeYard statistics
compute_cell_stats_per_workspace
- datavision_beeyard_sdk.api.statistics.compute_cell_stats_per_workspace.cell_count(workspace_id: str, *, client: AuthenticatedClient, accept: str = 'application/json', query='')
Aggregate cells per workspace.
- Parameters:
workspace_id (str) – Target workspace id.
client (AuthenticatedClient) – BeeYard client.
accept (str, optional) – mime type, by default “application/json”
query (str, optional) – MongoDB query, by default “”
- Returns:
Dictionary describing the cell.
- Return type:
dict
compute_file_stats
compute_shape_stats
- datavision_beeyard_sdk.api.statistics.compute_shape_stats.compute(workspace_id: str, *, client: AuthenticatedClient, query: str)
Compute statistics on shapes in specific workspace and only on data cells.
- Parameters:
workspace_id (str) – Target workspace id.
client (AuthenticatedClient) – BeeYard client.
query (str) – MongoDB query. It can also be empty “”.
- Returns:
Dictionary describing the cell.
- Return type:
dict
compute_tag_stats
- datavision_beeyard_sdk.api.statistics.compute_tag_stats.compute(workspace_id: str, *, client: AuthenticatedClient, query: str)
Compute statistics on tags in specific workspace and only on data cells.
- Parameters:
workspace_id (str) – Target workspace id.
client (AuthenticatedClient) – BeeYard client.
query (str, optional) – MongoDB query, by default “”
- Returns:
Dictionary describing the cell.
- Return type:
dict
Version package
Get actual BeeYard version
read_version
- datavision_beeyard_sdk.api.version.read_version.version(*, client: AuthenticatedClient)
Get BeeYard version
- Parameters:
client (AuthenticatedClient) – BeeYard client.
- Returns:
Content of the Http response from API as a json.
- Return type:
json string
Workspace package
Interact with workspaces
add_favorite_queries
- datavision_beeyard_sdk.api.workspace.add_favorite_queries.add(workspace_id: str, *, client: ~datavision_beeyard_sdk.client.AuthenticatedClient, query_to_add: [<class 'datavision_beeyard_sdk.models.favorite_query_dto.FavoriteQueryDto'>])
Save MongoDB queries to workspace.
- Parameters:
workspace_id (str) – Target workspace id.
client (AuthenticatedClient) – BeeYard client.
query_to_add (list[FavoriteQueryDto]) – List of MongoDB queries to add.
- Returns:
Http response from API.
- Return type:
add_or_replace_favorite_query
- datavision_beeyard_sdk.api.workspace.add_or_replace_favorite_query.replace(workspace_id: str, *, client: AuthenticatedClient, query_update: FavoriteQueryDto)
Replace favorite query in workspace.
If query does not exist, it is saved.
- Parameters:
workspace_id (str) – Target workspace id.
client (AuthenticatedClient) – BeeYard client.
query_update (FavoriteQueryDto) – Object containing MongoDB query.
- Returns:
Http response from API.
- Return type:
add_or_replace_shape_template
- datavision_beeyard_sdk.api.workspace.add_or_replace_shape_template.add(workspace_id: str, *, client: AuthenticatedClient, json_body: str)
Replace shape template in workspace.
If shape template does not exist, it is saved.
- Parameters:
workspace_id (str) – Target workspace id.
client (AuthenticatedClient) – BeeYard client.
json_body (json str) – Json string containing shape template.
- Returns:
Http response from API.
- Return type:
add_shape_templates
- datavision_beeyard_sdk.api.workspace.add_shape_templates.add(workspace_id: str, *, client: AuthenticatedClient, json_body: str)
Add shape templates to workspace.
- Parameters:
workspace_id (str) – Target workspace id.
client (AuthenticatedClient) – BeeYard client.
json_body (json str) – Json string containing a list of tag templates.
- Returns:
Http response from API.
- Return type:
add_tag_templates
- datavision_beeyard_sdk.api.workspace.add_tag_templates.add(workspace_id: str, *, client: AuthenticatedClient, tag_list: List[TagTemplateDto])
Add tag templates to workspace.
- Parameters:
workspace_id (str) – Target workspace id.
client (AuthenticatedClient) – BeeYard client.
tag_list (list[TagTemplateDto]) – List of tag templates to be added.
- Returns:
Http response from API.
- Return type:
create_workspace
- datavision_beeyard_sdk.api.workspace.create_workspace.create(*, client: AuthenticatedClient, request_body: WorkspaceDescriptorDto)
Create a new workspace.
- Parameters:
client (AuthenticatedClient) – BeeYard client.
request_body (WorkspaceDescriptorDto) – Object containing name and namespace of the new workspace.
- Returns:
Http response from API.
- Return type:
modify_favorite_query
- datavision_beeyard_sdk.api.workspace.modify_favorite_query.update(workspace_id: str, *, client: AuthenticatedClient, query_name: str, query_update: FavoriteQueryDto)
Modify a favorite query.
- Parameters:
workspace_id (str) – Target workspace id.
client (AuthenticatedClient) – BeeYard client.
query_name (str) – Name of target query.
query_update (FavoriteQueryDto) – Object containing the new query.
- Returns:
Http response from API.
- Return type:
modify_shape_template
- datavision_beeyard_sdk.api.workspace.modify_shape_template.update(workspace_id: str, *, client: AuthenticatedClient, shape_template_name: str, json_body: str)
Modify a shape template.
- Parameters:
workspace_id (str) – Target workspace id.
client (AuthenticatedClient) – BeeYard client.
shape_template_name (str) – Name of target shape template.
json_body (json str) – Json string containing the new tag template.
- Returns:
Http response from API.
- Return type:
modify_workspace
- datavision_beeyard_sdk.api.workspace.modify_workspace.update(workspace_id: str, *, client: AuthenticatedClient, json_body: str)
Modify workspace name.
- Parameters:
workspace_id (str) – Target workspace id.
client (AuthenticatedClient) – BeeYard client.
json_body (json str) – Json string containing the new workspace name.
- Returns:
Http response from API.
- Return type:
read_workspace
- datavision_beeyard_sdk.api.workspace.read_workspace.read(workspace_id: str, *, client: AuthenticatedClient)
Read a workspace information.
- Parameters:
workspace_id (str) – Target workspace id.
client (AuthenticatedClient) – BeeYard client.
- Returns:
Content of the Http response from API as a json.
- Return type:
json string
remove_favorite_queries
- datavision_beeyard_sdk.api.workspace.remove_favorite_queries.delete(workspace_id: str, *, client: ~datavision_beeyard_sdk.client.AuthenticatedClient, queries_list: [<class 'str'>])
Remove favorite queries from workspace.
- Parameters:
workspace_id (str) – Target workspace id.
client (AuthenticatedClient) – BeeYard client.
queries_list (list[str]) – List of queries to be removed.
- Returns:
Http response from API.
- Return type:
remove_shape_templates
- datavision_beeyard_sdk.api.workspace.remove_shape_templates.delete(workspace_id: str, *, client: ~datavision_beeyard_sdk.client.AuthenticatedClient, template_list: [<class 'str'>])
Remove shape templates from workspace.
- Parameters:
workspace_id (str) – Target workspace id.
client (AuthenticatedClient) – BeeYard client.
template_list (list[str]) – List of shape templates to be removed.
- Returns:
Http response from API.
- Return type:
remove_tag_templates
- datavision_beeyard_sdk.api.workspace.remove_tag_templates.delete(workspace_id: str, *, client: ~datavision_beeyard_sdk.client.AuthenticatedClient, tag_list: [<class 'datavision_beeyard_sdk.models.tag_template_dto.TagTemplateDto'>])
Remove tag templates from workspace.
- Parameters:
workspace_id (str) – Target workspace id.
client (AuthenticatedClient) – BeeYard client.
tag_list (list[TagTemplateDto]) – List of tag templates to be removed.
- Returns:
Http response from API.
- Return type:
remove_workspace
- datavision_beeyard_sdk.api.workspace.remove_workspace.delete(workspace_id: str, *, client: AuthenticatedClient)
Remove a workspace.
To be able to remove a workspace, it must be empty.
- Parameters:
workspace_id (str) – Target workspace id.
client (AuthenticatedClient) – BeeYard client.
- Returns:
Http response from API.
- Return type:
search_workspaces
- datavision_beeyard_sdk.api.workspace.search_workspaces.search(*, client: AuthenticatedClient, query='', sort_by='created', sort_direction='asc', page_index=0, page_size=100)
Execute a query on all workspaces.
- Parameters:
client (AuthenticatedClient) – BeeYard client.
query (str, optional) – MongoDB query, by default “”
sort_by ({'created', 'modified', 'name', 'namespace'}, optional) – Sort results, by default “created”
sort_direction ({'asc', 'desc'}, optional) – Sort results order, by default “asc”
page_index (int, optional) – Start from given page result, by default 0
page_size (int, optional) – Number of result per page, by default 100
- Returns:
Results of the query.
- Return type:
dict
Models module
Contains all the data models used in inputs/outputs.
Models can be imported with from datavision_beeyard_sdk.models import *
.
Examples
>>> from datavision_beeyard_sdk.models import AddImagesMultipartData >>> f = File(payload=data, file_name="test.png", mime_type="image/png") >>> AddImagesMultipartData([f]) AddImagesMultipartData(files=[File(payload=b'PNG [...] 02=joìIEND®B`', file_name='test.png', mime_type='image/png')], additional_properties={})
add_documents_multipart_data
- class datavision_beeyard_sdk.models.add_documents_multipart_data.AddDocumentsMultipartData(files: ~datavision_beeyard_sdk.types.Unset | ~typing.List[~datavision_beeyard_sdk.types.File] = <datavision_beeyard_sdk.types.Unset object>)
Bases:
object
- files: Unset | List[File]
add_files_multipart_data
- class datavision_beeyard_sdk.models.add_files_multipart_data.AddFilesMultipartData(files: ~datavision_beeyard_sdk.types.Unset | ~typing.List[~datavision_beeyard_sdk.types.File] = <datavision_beeyard_sdk.types.Unset object>)
Bases:
object
- files: Unset | List[File]
add_images_multipart_data
- class datavision_beeyard_sdk.models.add_images_multipart_data.AddImagesMultipartData(files: ~datavision_beeyard_sdk.types.Unset | ~typing.List[~datavision_beeyard_sdk.types.File] = <datavision_beeyard_sdk.types.Unset object>)
Bases:
object
- files: Unset | List[File]
favorite_query_dto
filter
modify_cell_input_dto
modify_document_input_dto
modify_overlay_multipart_data
property_dto
reference_dto
tag_dto
tag_template_dto
upload_cell_multipart_data
upload_mask_multipart_data
workspace_descriptor_dto
- class datavision_beeyard_sdk.models.workspace_descriptor_dto.WorkspaceDescriptorDto(workspace_id: ~datavision_beeyard_sdk.types.Unset | str = <datavision_beeyard_sdk.types.Unset object>, name: ~datavision_beeyard_sdk.types.Unset | None | str = <datavision_beeyard_sdk.types.Unset object>, namespace: ~datavision_beeyard_sdk.types.Unset | None | str = <datavision_beeyard_sdk.types.Unset object>)
Bases:
object