ayon_api package¶
- class GlobalServerAPI(site_id=None, client_version=None, default_settings_variant=None, ssl_verify=None, cert=None)[source]¶
Bases:
ServerAPI
Extended server api which also handles storing tokens and url.
Created object expect to have set environment variables ‘AYON_SERVER_URL’. Also is expecting filled ‘AYON_API_KEY’ but that can be filled afterwards with calling ‘login’ method.
- class RequestTypes[source]¶
Bases:
object
- delete = <ayon_api.server_api.RequestType object>¶
- get = <ayon_api.server_api.RequestType object>¶
- patch = <ayon_api.server_api.RequestType object>¶
- post = <ayon_api.server_api.RequestType object>¶
- put = <ayon_api.server_api.RequestType object>¶
- class ServerAPI(base_url, token=None, site_id=<object object>, client_version=None, default_settings_variant=None, sender=None, ssl_verify=None, cert=None, create_session=True, timeout=None, max_retries=None)[source]¶
Bases:
object
Base handler of connection to server.
Requires url to server which is used as base for api and graphql calls.
Login cause that a session is used
- Parameters:
base_url (
str
) – Example: http://localhost:5000token (
Optional[str]
) – Access token (api key) to server.site_id (
Optional[str]
) – Unique name of site. Should be the same when connection is created from the same machine under same user.client_version (
Optional[str]
) – Version of client application (used in desktop client application).default_settings_variant (
Optional[Literal["production", "staging"]]
) – Settings variant used by default if a method for settings won’t get any (by default is ‘production’).sender (
Optional[str]
) – Sender of requests. Used in server logs and propagated into events.ssl_verify (
Union[bool, str, None]
) – Verify SSL certificate Looks for env variable valueAYON_CA_FILE
by default. If not available then ‘True’ is used.cert (
Optional[str]
) – Path to certificate file. Looks for env variable valueAYON_CERT_FILE
by default.create_session (
Optional[bool]
) – Create session for connection if token is available. Default is True.timeout (
Optional[float]
) – Timeout for requests.max_retries (
Optional[int]
) – Number of retries for requests.
- property access_token¶
Access token used for authorization to server.
- Returns:
Token string or None if not authorized yet.
- Return type:
Union[str, None]
- as_username(username)[source]¶
Service API will temporarily work as other user.
This method can be used only if service API key is logged in.
- Parameters:
username (
Union[str, None]
) – Username to work as when service.- Raises:
ValueError – When connection is not yet authenticated or api key is not service token.
- property base_url¶
- property cert¶
Current cert file used for connection to server.
- Returns:
Path to cert file.
- Return type:
Union[str, None]
- check_bundle_compatibility(name, addon_versions, installer_version, dependency_packages=None, is_production=None, is_staging=None, is_dev=None, dev_active_user=None, dev_addons_config=None)[source]¶
Check bundle compatibility.
Can be used as per-flight validation before creating bundle.
- Parameters:
name (
str
) – Name of bundle.addon_versions (
dict[str, str]
) – Addon versions.installer_version (
Union[str, None]
) – Installer version.dependency_packages (
Optional[dict[str, str]]
) – Dependency package names. Keys are platform names and values are name of packages.is_production (
Optional[bool]
) – Bundle will be marked as production.is_staging (
Optional[bool]
) – Bundle will be marked as staging.is_dev (
Optional[bool]
) – Bundle will be marked as dev.dev_active_user (
Optional[str]
) – Username that will be assigned to dev bundle. Can be used only if ‘is_dev’ is set to ‘True’.dev_addons_config (
Optional[dict[str, Any]]
) – Configuration for dev addons. Can be used only if ‘is_dev’ is set to ‘True’.
- Returns:
Server response, with ‘success’ and ‘issues’.
- Return type:
Dict[str, Any]
- property client_version¶
Version of client used to connect to server.
Client version is AYON client build desktop application.
- Returns:
Client version string used in connection.
- Return type:
str
- create_bundle(name, addon_versions, installer_version, dependency_packages=None, is_production=None, is_staging=None, is_dev=None, dev_active_user=None, dev_addons_config=None)[source]¶
Create bundle on server.
Bundle cannot be changed once is created. Only isProduction, isStaging and dependency packages can change after creation. In case dev bundle is created, it is possible to change anything, but it is not possible to mark bundle as dev and production or staging at the same time.
Development addon config can define custom path to client code. It is used only for dev bundles.
Example of ‘dev_addons_config’:
```json { "core": { "enabled": true, "path": "/path/to/ayon-core/client" } } ```
- Parameters:
name (
str
) – Name of bundle.addon_versions (
dict[str, str]
) – Addon versions.installer_version (
Union[str, None]
) – Installer version.dependency_packages (
Optional[dict[str, str]]
) – Dependency package names. Keys are platform names and values are name of packages.is_production (
Optional[bool]
) – Bundle will be marked as production.is_staging (
Optional[bool]
) – Bundle will be marked as staging.is_dev (
Optional[bool]
) – Bundle will be marked as dev.dev_active_user (
Optional[str]
) – Username that will be assigned to dev bundle. Can be used only if ‘is_dev’ is set to ‘True’.dev_addons_config (
Optional[dict[str, Any]]
) – Configuration for dev addons. Can be used only if ‘is_dev’ is set to ‘True’.
- create_dependency_package(filename, python_modules, source_addons, installer_version, checksum, checksum_algorithm, file_size, sources=None, platform_name=None)[source]¶
Create dependency package on server.
The package will be created on a server, it is also required to upload the package archive file (using
upload_dependency_package()
).- Parameters:
filename (
str
) – Filename of dependency package.python_modules (
dict[str, str]
) –Python modules in dependency package:
{"<module name>": "<module version>", ...}
source_addons (
dict[str, str]
) –Name of addons for which is dependency package created:
{"<addon name>": "<addon version>", ...}
installer_version (
str
) – Version of installer for which was package created.checksum (
str
) – Checksum of archive file where dependencies are.checksum_algorithm (
str
) – Algorithm used to calculate checksum.file_size (
Optional[int]
) – Size of file.sources (
Optional[list[dict[str, Any]]]
) – Information about sources from where it is possible to get file.platform_name (
Optional[str]
) – Name of platform for which is dependency package targeted. Default value is current platform.
- create_folder(project_name, name, folder_type=None, parent_id=None, label=None, attrib=None, data=None, tags=None, status=None, active=None, thumbnail_id=None, folder_id=None)[source]¶
Create new folder.
- Parameters:
project_name (
str
) – Project name.name (
str
) – Folder name.folder_type (
Optional[str]
) – Folder type.parent_id (
Optional[str]
) – Parent folder id. Parent is project if isNone
.label (
Optional[str]
) – Label of folder.attrib (
Optional[dict[str, Any]]
) – Folder attributes.data (
Optional[dict[str, Any]]
) – Folder data.tags (
Optional[Iterable[str]]
) – Folder tags.status (
Optional[str]
) – Folder status.active (
Optional[bool]
) – Folder active state.thumbnail_id (
Optional[str]
) – Folder thumbnail id.folder_id (
Optional[str]
) – Folder id. If not passed new id is generated.
- Returns:
Entity id.
- Return type:
str
- create_installer(filename, version, python_version, platform_name, python_modules, runtime_python_modules, checksum, checksum_algorithm, file_size, sources=None)[source]¶
Create new installer information on server.
- This step will create only metadata. Make sure to upload installer
to the server using ‘upload_installer’ method.
- Runtime python modules are modules that are required to run AYON
desktop application, but are not added to PYTHONPATH for any subprocess.
- Parameters:
filename (
str
) – Installer filename.version (
str
) – Version of installer.python_version (
str
) – Version of Python.platform_name (
str
) – Name of platform.python_modules (
dict[str, str]
) – Python modules that are available in installer.runtime_python_modules (
dict[str, str]
) – Runtime python modules that are available in installer.checksum (
str
) – Installer file checksum.checksum_algorithm (
str
) – Type of checksum used to create checksum.file_size (
int
) – File size.sources (
Optional[list[dict[str, Any]]]
) – List of sources that can be used to download file.
- create_link(project_name, link_type_name, input_id, input_type, output_id, output_type, link_name=None)[source]¶
Create link between 2 entities.
Link has a type which must already exists on a project.
Example output:
{ "id": "59a212c0d2e211eda0e20242ac120002" }
- Parameters:
project_name (
str
) – Project where the link is created.link_type_name (
str
) – Type of link.input_id (
str
) – Input entity id.input_type (
str
) – Entity type of input entity.output_id (
str
) – Output entity id.output_type (
str
) – Entity type of output entity.link_name (
Optional[str]
) – Name of link. Available from server version ‘1.0.0-rc.6’.
- Returns:
Information about link.
- Return type:
dict[str, str]
- Raises:
HTTPRequestError – Server error happened.
- create_link_type(project_name, link_type_name, input_type, output_type, data=None)[source]¶
Create or update link type on server.
Warning
Because PUT is used for creation it is also used for update.
- Parameters:
project_name (
str
) – Project where link type is created.link_type_name (
str
) – Name of link type.input_type (
str
) – Input entity type of link.output_type (
str
) – Output entity type of link.data (
Optional[dict[str, Any]]
) – Additional data related to link.
- Raises:
HTTPRequestError – Server error happened.
- create_product(project_name, name, product_type, folder_id, attrib=None, data=None, tags=None, status=None, active=None, product_id=None)[source]¶
Create new product.
- Parameters:
project_name (
str
) – Project name.name (
str
) – Product name.product_type (
str
) – Product type.folder_id (
str
) – Parent folder id.attrib (
Optional[dict[str, Any]]
) – Product attributes.data (
Optional[dict[str, Any]]
) – Product data.tags (
Optional[Iterable[str]]
) – Product tags.status (
Optional[str]
) – Product status.active (
Optional[bool]
) – Product active state.product_id (
Optional[str]
) – Product id. If not passed new id is generated.
- Returns:
Product id.
- Return type:
str
- create_project(project_name, project_code, library_project=False, preset_name=None)[source]¶
Create project using AYON settings.
This project creation function is not validating project entity on creation. It is because project entity is created blindly with only minimum required information about project which is name and code.
Entered project name must be unique and project must not exist yet.
Note
- This function is here to be OP v4 ready but in v3 has more logic
to do. That’s why inner imports are in the body.
- Parameters:
project_name (
str
) – New project name. Should be unique.project_code (
str
) – Project’s code should be unique too.library_project (
Optional[bool]
) – Project is library project.preset_name (
Optional[str]
) – Name of anatomy preset. Default is used if not passed.
- Raises:
ValueError – When project name already exists.
- Returns:
Created project entity.
- Return type:
dict[str, Any]
- create_representation(project_name, name, version_id, files=None, attrib=None, data=None, tags=None, status=None, active=None, representation_id=None)[source]¶
Create new representation.
- Parameters:
project_name (
str
) – Project name.name (
str
) – Representation name.version_id (
str
) – Parent version id.files (
Optional[list[dict]]
) – Representation files information.attrib (
Optional[dict[str, Any]]
) – Representation attributes.data (
Optional[dict[str, Any]]
) – Representation data.tags (
Optional[Iterable[str]]
) – Representation tags.status (
Optional[str]
) – Representation status.active (
Optional[bool]
) – Representation active state.representation_id (
Optional[str]
) – Representation id. If not passed new id is generated.
- Returns:
Representation id.
- Return type:
str
- create_session(ignore_existing=True, force=False)[source]¶
Create a connection session.
Session helps to keep connection with server without need to reconnect on each call.
- Parameters:
ignore_existing (
bool
) – If session already exists, ignore creation.force (
bool
) – If session already exists, close it and create new.
- create_task(project_name, name, task_type, folder_id, label=None, assignees=None, attrib=None, data=None, tags=None, status=None, active=None, thumbnail_id=None, task_id=None)[source]¶
Create new task.
- Parameters:
project_name (
str
) – Project name.name (
str
) – Folder name.task_type (
str
) – Task type.folder_id (
str
) – Parent folder id.label (
Optional[str]
) – Label of folder.assignees (
Optional[Iterable[str]]
) – Task assignees.attrib (
Optional[dict[str, Any]]
) – Task attributes.data (
Optional[dict[str, Any]]
) – Task data.tags (
Optional[Iterable[str]]
) – Task tags.status (
Optional[str]
) – Task status.active (
Optional[bool]
) – Task active state.thumbnail_id (
Optional[str]
) – Task thumbnail id.task_id (
Optional[str]
) – Task id. If not passed new id is generated.
- Returns:
Task id.
- Return type:
str
- create_thumbnail(project_name, src_filepath, thumbnail_id=None)[source]¶
Create new thumbnail on server from passed path.
- Parameters:
project_name (
str
) – Project where the thumbnail will be created and can be used.src_filepath (
str
) – Filepath to thumbnail which should be uploaded.thumbnail_id (
Optional[str]
) – Prepared if of thumbnail.
- Returns:
Created thumbnail id.
- Return type:
str
- Raises:
ValueError – When thumbnail source cannot be processed.
- create_version(project_name, version, product_id, task_id=None, author=None, attrib=None, data=None, tags=None, status=None, active=None, thumbnail_id=None, version_id=None)[source]¶
Create new version.
- Parameters:
project_name (
str
) – Project name.version (
int
) – Version.product_id (
str
) – Parent product id.task_id (
Optional[str]
) – Parent task id.author (
Optional[str]
) – Version author.attrib (
Optional[dict[str, Any]]
) – Version attributes.data (
Optional[dict[str, Any]]
) – Version data.tags (
Optional[Iterable[str]]
) – Version tags.status (
Optional[str]
) – Version status.active (
Optional[bool]
) – Version active state.thumbnail_id (
Optional[str]
) – Version thumbnail id.version_id (
Optional[str]
) – Version id. If not passed new id is generated.
- Returns:
Version id.
- Return type:
str
- default_download_chunk_size = 1048576¶
- property default_settings_variant¶
Default variant used for settings.
- Returns:
name of variant or None.
- Return type:
Union[str, None]
- default_upload_chunk_size = 1048576¶
- delete_bundle(bundle_name)[source]¶
Delete bundle from server.
- Parameters:
bundle_name (
str
) – Name of bundle to delete.
- delete_dependency_package(filename, platform_name=None)[source]¶
Remove dependency package for specific platform.
- Parameters:
filename (
str
) – Filename of dependency package.platform_name (
Optional[str]
) – Deprecated.
- delete_folder(project_name, folder_id, force=False)[source]¶
Delete folder.
- Parameters:
project_name (
str
) – Project name.folder_id (
str
) – Folder id to delete.force (
Optional[bool]
) – Folder delete folder with all children folder, products, versions and representations.
- delete_installer(filename)[source]¶
Delete installer from server.
- Parameters:
filename (
str
) – Installer filename.
- delete_link(project_name, link_id)[source]¶
Remove link by id.
- Parameters:
project_name (
str
) – Project where link exists.link_id (
str
) – Id of link.
- Raises:
HTTPRequestError – Server error happened.
- delete_link_type(project_name, link_type_name, input_type, output_type)[source]¶
Remove link type from project.
- Parameters:
project_name (
str
) – Project where link type is created.link_type_name (
str
) – Name of link type.input_type (
str
) – Input entity type of link.output_type (
str
) – Output entity type of link.
- Raises:
HTTPRequestError – Server error happened.
- delete_product(project_name, product_id)[source]¶
Delete product.
- Parameters:
project_name (
str
) – Project name.product_id (
str
) – Product id to delete.
- delete_project(project_name)[source]¶
Delete project from server.
This will completely remove project from server without any step back.
- Parameters:
project_name (
str
) – Project name that will be removed.
- delete_representation(project_name, representation_id)[source]¶
Delete representation.
- Parameters:
project_name (
str
) – Project name.representation_id (
str
) – Representation id to delete.
- delete_secret(secret_name)[source]¶
Delete secret by name.
- Parameters:
secret_name (
str
) – Name of secret to delete.
- delete_task(project_name, task_id)[source]¶
Delete task.
- Parameters:
project_name (
str
) – Project name.task_id (
str
) – Task id to delete.
- delete_version(project_name, version_id)[source]¶
Delete version.
- Parameters:
project_name (
str
) – Project name.version_id (
str
) – Version id to delete.
- dispatch_event(topic, sender=None, event_hash=None, project_name=None, username=None, depends_on=None, description=None, summary=None, payload=None, finished=True, store=True, dependencies=None)[source]¶
Dispatch event to server.
- Parameters:
topic (
str
) – Event topic used for filtering of listeners.sender (
Optional[str]
) – Sender of event.event_hash (
Optional[str]
) – Event hash.project_name (
Optional[str]
) – Project name.depends_on (
Optional[str]
) – Add dependency to another event.username (
Optional[str]
) – Username which triggered event.description (
Optional[str]
) – Description of event.summary (
Optional[dict[str, Any]]
) – Summary of event that can be used for simple filtering on listeners.payload (
Optional[dict[str, Any]]
) – Full payload of event data with all details.finished (
Optional[bool]
) – Mark event as finished on dispatch.store (
Optional[bool]
) – Store event in event queue for possible future processing otherwise is event send only to active listeners.dependencies (
Optional[list[str]]
) – Deprecated. List of event id dependencies.
- Returns:
Response from server.
- Return type:
- download_addon_private_file(addon_name, addon_version, filename, destination_dir, destination_filename=None, chunk_size=None, progress=None)[source]¶
Download a file from addon private files.
This method requires to have authorized token available. Private files are not under ‘/api’ restpoint.
- Parameters:
addon_name (
str
) – Addon name.addon_version (
str
) – Addon version.filename (
str
) – Filename in private folder on server.destination_dir (
str
) – Where the file should be downloaded.destination_filename (
Optional[str]
) – Name of destination filename. Source filename is used if not passed.chunk_size (
Optional[int]
) – Download chunk size.progress (
Optional[TransferProgress]
) – Object that gives ability to track download progress.
- Returns:
Filepath to downloaded file.
- Return type:
str
- download_dependency_package(src_filename, dst_directory, dst_filename, platform_name=None, chunk_size=None, progress=None)[source]¶
Download dependency package from server.
This method requires to have authorized token available. The package is only downloaded.
- Parameters:
src_filename (
str
) – Filename of dependency pacakge. For server version 0.2.0 and lower it is name of package to download.dst_directory (
str
) – Where the file should be downloaded.dst_filename (
str
) – Name of destination filename.platform_name (
Optional[str]
) – Deprecated.chunk_size (
Optional[int]
) – Download chunk size.progress (
Optional[TransferProgress]
) – Object that gives ability to track download progress.
- Returns:
Filepath to downloaded file.
- Return type:
str
- download_file(endpoint, filepath, chunk_size=None, progress=None)[source]¶
Download file from AYON server.
Endpoint can be full url (must start with ‘base_url’ of api object).
Progress object can be used to track download. Can be used when download happens in thread and other thread want to catch changes over time.
- Todos:
Use retries and timeout. Return RestApiResponse.
- Parameters:
endpoint (
str
) – Endpoint or URL to file that should be downloaded.filepath (
str
) – Path where file will be downloaded.chunk_size (
Optional[int]
) – Size of chunks that are received in single loop.progress (
Optional[TransferProgress]
) – Object that gives ability to track download progress.
- download_file_to_stream(endpoint, stream, chunk_size=None, progress=None)[source]¶
Download file from AYON server to IOStream.
Endpoint can be full url (must start with ‘base_url’ of api object).
Progress object can be used to track download. Can be used when download happens in thread and other thread want to catch changes over time.
- Todos:
Use retries and timeout. Return RestApiResponse.
- Parameters:
endpoint (
str
) – Endpoint or URL to file that should be downloaded.stream (
Union[io.BytesIO, BinaryIO]
) – Stream where output will be stored.chunk_size (
Optional[int]
) – Size of chunks that are received in single loop.progress (
Optional[TransferProgress]
) – Object that gives ability to track download progress.
- download_installer(filename, dst_filepath, chunk_size=None, progress=None)[source]¶
Download installer file from server.
- Parameters:
filename (
str
) – Installer filename.dst_filepath (
str
) – Destination filepath.chunk_size (
Optional[int]
) – Download chunk size.progress (
Optional[TransferProgress]
) – Object that gives ability to track download progress.
- enroll_event_job(source_topic, target_topic, sender, description=None, sequential=None, events_filter=None, max_retries=None)[source]¶
Enroll job based on events.
Enroll will find first unprocessed event with ‘source_topic’ and will create new event with ‘target_topic’ for it and return the new event data.
Use ‘sequential’ to control that only single target event is created at same time. Creation of new target events is blocked while there is at least one unfinished event with target topic, when set to ‘True’. This helps when order of events matter and more than one process using the same target is running at the same time.
Make sure the new event has updated status to ‘“finished”’ status when you’re done with logic
Target topic should not clash with other processes/services.
Created target event have ‘dependsOn’ key where is id of source topic.
- Use-case:
Service 1 is creating events with topic ‘my.leech’
- Service 2 process ‘my.leech’ and uses target topic ‘my.process’
this service can run on 1-n machines
- all events must be processed in a sequence by their creation
time and only one event can be processed at a time
- in this case ‘sequential’ should be set to ‘True’ so only
one machine is actually processing events, but if one goes down there are other that can take place
- Service 3 process ‘my.leech’ and uses target topic ‘my.discover’
this service can run on 1-n machines
order of events is not important
‘sequential’ should be ‘False’
- Parameters:
source_topic (
str
) – Source topic to enroll.target_topic (
str
) – Topic of dependent event.sender (
str
) – Identifier of sender (e.g. service name or username).description (
Optional[str]
) – Human readable text shown in target event.sequential (
Optional[bool]
) – The source topic must be processed in sequence.events_filter (
Optional[dict[str, Any]]
) – Filtering conditions to filter the source event. For more technical specifications look to server backed ‘ayon_server.sqlfilter.Filter’. TODO: Add example of filters.max_retries (
Optional[int]
) – How many times can be event retried. Default value is based on server (3 at the time of this PR).
- Returns:
- None if there is no event matching
filters. Created event with ‘target_topic’.
- Return type:
Union[None, dict[str, Any]]
- get_addon_endpoint(addon_name, addon_version, *subpaths)[source]¶
Calculate endpoint to addon route.
Examples
>>> api = ServerAPI("https://your.url.com") >>> api.get_addon_url( ... "example", "1.0.0", "private", "my.zip") 'addons/example/1.0.0/private/my.zip'
- Parameters:
addon_name (
str
) – Name of addon.addon_version (
str
) – Version of addon.*subpaths (
str
) – Any amount of subpaths that are added to addon url.
- Returns:
Final url.
- Return type:
str
- get_addon_project_settings(addon_name, addon_version, project_name, variant=None, site_id=None, use_site=True)[source]¶
Addon project settings.
Receive project settings for specific version of an addon. The settings may be with site overrides when enabled.
Site id is filled with current connection site id if not passed. To make sure any site id is used set ‘use_site’ to ‘False’.
- Parameters:
addon_name (
str
) – Name of addon.addon_version (
str
) – Version of addon.project_name (
str
) – Name of project for which the settings are received.variant (
Optional[Literal['production', 'staging']]
) – Name of settings variant. Used ‘default_settings_variant’ by default.site_id (
Optional[str]
) – Name of site which is used for site overrides. Is filled with connection ‘site_id’ attribute if not passed.use_site (
Optional[bool]
) – To force disable option of using site overrides set to ‘False’. In that case won’t be applied any site overrides.
- Returns:
Addon settings.
- Return type:
dict[str, Any]
- get_addon_settings(addon_name, addon_version, project_name=None, variant=None, site_id=None, use_site=True)[source]¶
Receive addon settings.
Receive addon settings based on project name value. Some arguments may be ignored if ‘project_name’ is set to ‘None’.
- Parameters:
addon_name (
str
) – Name of addon.addon_version (
str
) – Version of addon.project_name (
Optional[str]
) – Name of project for which the settings are received. A studio settings values are received if is ‘None’.variant (
Optional[Literal['production', 'staging']]
) – Name of settings variant. Used ‘default_settings_variant’ by default.site_id (
Optional[str]
) – Name of site which is used for site overrides. Is filled with connection ‘site_id’ attribute if not passed.use_site (
Optional[bool]
) – To force disable option of using site overrides set to ‘False’. In that case won’t be applied any site overrides.
- Returns:
Addon settings.
- Return type:
dict[str, Any]
- get_addon_settings_schema(addon_name, addon_version, project_name=None)[source]¶
Sudio/Project settings schema of an addon.
Project schema may look differently as some enums are based on project values.
- Parameters:
addon_name (
str
) – Name of addon.addon_version (
str
) – Version of addon.project_name (
Optional[str]
) – Schema for specific project or default studio schemas.
- Returns:
Schema of studio/project settings.
- Return type:
dict[str, Any]
- get_addon_site_settings(addon_name, addon_version, site_id=None)[source]¶
Site settings of an addon.
If site id is not available an empty dictionary is returned.
- Parameters:
addon_name (
str
) – Name of addon.addon_version (
str
) – Version of addon.site_id (
Optional[str]
) – Name of site for which should be settings returned. using ‘site_id’ attribute if not passed.
- Returns:
Site settings.
- Return type:
dict[str, Any]
- get_addon_site_settings_schema(addon_name, addon_version)[source]¶
Site settings schema of an addon.
- Parameters:
addon_name (
str
) – Name of addon.addon_version (
str
) – Version of addon.
- Returns:
Schema of site settings.
- Return type:
dict[str, Any]
- get_addon_studio_settings(addon_name, addon_version, variant=None)[source]¶
Addon studio settings.
Receive studio settings for specific version of an addon.
- Parameters:
addon_name (
str
) – Name of addon.addon_version (
str
) – Version of addon.variant (
Optional[Literal['production', 'staging']]
) – Name of settings variant. Used ‘default_settings_variant’ by default.
- Returns:
Addon settings.
- Return type:
dict[str, Any]
- get_addon_url(addon_name, addon_version, *subpaths, use_rest=True)[source]¶
Calculate url to addon route.
Examples
>>> api = ServerAPI("https://your.url.com") >>> api.get_addon_url( ... "example", "1.0.0", "private", "my.zip") 'https://your.url.com/api/addons/example/1.0.0/private/my.zip'
- Parameters:
addon_name (
str
) – Name of addon.addon_version (
str
) – Version of addon.*subpaths (
str
) – Any amount of subpaths that are added to addon url.use_rest (
Optional[bool]
) – Use rest endpoint.
- Returns:
Final url.
- Return type:
str
- get_addons_info(details=True)[source]¶
Get information about addons available on server.
- Parameters:
details (
Optional[bool]
) – Detailed data with information how to get client code.
- get_addons_project_settings(project_name, bundle_name=None, variant=None, site_id=None, use_site=True, only_values=True)[source]¶
Project settings of all addons.
Server returns information about used addon versions, so full output looks like:
The output can be limited to only values. To do so is ‘only_values’ argument which is by default set to ‘True’. In that case output contains only value of ‘settings’ key.
Warning
- Behavior of this function changed with AYON server version 0.3.0.
Structure of output from server changed. If using ‘only_values=True’ then output should be same as before.
- Parameters:
project_name (
str
) – Name of project for which are settings received.bundle_name (
Optional[str]
) – Name of bundle for which should be settings received.variant (
Optional[Literal['production', 'staging']]
) – Name of settings variant. Used ‘default_settings_variant’ by default.site_id (
Optional[str]
) – Site id for which want to receive site overrides.use_site (
bool
) – To force disable option of using site overrides set to ‘False’. In that case won’t be applied any site overrides.only_values (
Optional[bool]
) – Output will contain only settings values without metadata about addons.
- Returns:
- Settings of all addons on server for passed
project.
- Return type:
dict[str, Any]
- get_addons_settings(bundle_name=None, project_name=None, variant=None, site_id=None, use_site=True, only_values=True)[source]¶
Universal function to receive all addon settings.
Based on ‘project_name’ will receive studio settings or project settings. In case project is not passed is ‘site_id’ ignored.
Warning
- Behavior of this function changed with AYON server version 0.3.0.
Structure of output from server changed. If using ‘only_values=True’ then output should be same as before.
- Parameters:
bundle_name (
Optional[str]
) – Name of bundle for which should be settings received.project_name (
Optional[str]
) – Name of project for which should be settings received.variant (
Optional[Literal['production', 'staging']]
) – Name of settings variant. Used ‘default_settings_variant’ by default.site_id (
Optional[str]
) – Id of site for which want to receive site overrides.use_site (
Optional[bool]
) – To force disable option of using site overrides set to ‘False’. In that case won’t be applied any site overrides.only_values (
Optional[bool]
) – Only settings values will be returned. By default, is set to ‘True’.
- get_addons_studio_settings(bundle_name=None, variant=None, site_id=None, use_site=True, only_values=True)[source]¶
All addons settings in one bulk.
Warning
- Behavior of this function changed with AYON server version 0.3.0.
Structure of output from server changed. If using ‘only_values=True’ then output should be same as before.
- Parameters:
bundle_name (
Optional[str]
) – Name of bundle for which should be settings received.variant (
Optional[Literal['production', 'staging']]
) – Name of settings variant. Used ‘default_settings_variant’ by default.site_id (
Optional[str]
) – Site id for which want to receive site overrides.use_site (
bool
) – To force disable option of using site overrides set to ‘False’. In that case won’t be applied any site overrides.only_values (
Optional[bool]
) – Output will contain only settings values without metadata about addons.
- Returns:
Settings of all addons on server.
- Return type:
dict[str, Any]
- get_attributes_fields_for_type(entity_type)[source]¶
Prepare attribute fields for entity type.
- Returns:
Attributes fields for entity type.
- Return type:
set[str]
- get_attributes_for_type(entity_type)[source]¶
Get attribute schemas available for an entity type.
Example:
``` # Example attribute schema { # Common "type": "integer", "title": "Clip Out", "description": null, "example": 1, "default": 1, # These can be filled based on value of 'type' "gt": null, "ge": null, "lt": null, "le": null, "minLength": null, "maxLength": null, "minItems": null, "maxItems": null, "regex": null, "enum": null } ```
- Parameters:
entity_type (
str
) – Entity type for which should be attributes received.- Returns:
- Attribute schemas that are available
for entered entity type.
- Return type:
dict[str, dict[str, Any]]
- get_build_in_anatomy_preset()[source]¶
Get built-in anatomy preset.
- Returns:
Built-in anatomy preset.
- Return type:
dict[str, Any]
- get_bundle_settings(bundle_name=None, project_name=None, variant=None, site_id=None, use_site=True)[source]¶
Get complete set of settings for given data.
If project is not passed then studio settings are returned. If variant is not passed ‘default_settings_variant’ is used. If bundle name is not passed then current production/staging bundle is used, based on variant value.
Output contains addon settings and site settings in single dictionary.
- Todos:
test how it behaves if there is not any bundle.
- test how it behaves if there is not any production/staging
bundle.
Example output:
{ "addons": [ { "name": "addon-name", "version": "addon-version", "settings": {...}, "siteSettings": {...} } ] }
- Returns:
All settings for single bundle.
- Return type:
dict[str, Any]
- get_bundles()[source]¶
Server bundles with basic information.
This is example output:
{ "bundles": [ { "name": "my_bundle", "createdAt": "2023-06-12T15:37:02.420260", "installerVersion": "1.0.0", "addons": { "core": "1.2.3" }, "dependencyPackages": { "windows": "a_windows_package123.zip", "linux": "a_linux_package123.zip", "darwin": "a_mac_package123.zip" }, "isProduction": False, "isStaging": False } ], "productionBundle": "my_bundle", "stagingBundle": "test_bundle" }
- Returns:
Server bundles with basic information.
- Return type:
dict[str, Any]
- get_cert()[source]¶
Current cert file used for connection to server.
- Returns:
Path to cert file.
- Return type:
Union[str, None]
- get_client_version()[source]¶
Version of client used to connect to server.
Client version is AYON client build desktop application.
- Returns:
Client version string used in connection.
- Return type:
str
- get_default_anatomy_preset_name()[source]¶
Name of default anatomy preset.
Primary preset is used as default preset. But when primary preset is not set a built-in is used instead. Built-in preset is named ‘_’.
- Returns:
- Name of preset that can be used by
’get_project_anatomy_preset’.
- Return type:
str
- get_default_fields_for_type(entity_type)[source]¶
Default fields for entity type.
Returns most of commonly used fields from server.
- Parameters:
entity_type (
str
) – Name of entity type.- Returns:
Fields that should be queried from server.
- Return type:
set[str]
- classmethod get_default_max_retries()[source]¶
Default value for requests max retries.
First looks for environment variable SERVER_RETRIES_ENV_KEY, which can affect max retries value. If not available then use class attribute ‘_default_max_retries’.
- Returns:
Max retries value.
- Return type:
int
- get_default_service_username()[source]¶
Default username used for callbacks when used with service API key.
- Returns:
Username if any was filled.
- Return type:
Union[str, None]
- get_default_settings_variant()[source]¶
Default variant used for settings.
- Returns:
name of variant or None.
- Return type:
Union[str, None]
- classmethod get_default_timeout()[source]¶
Default value for requests timeout.
Utils function ‘get_default_timeout’ is used by default.
- Returns:
Timeout value in seconds.
- Return type:
float
- get_dependency_packages()[source]¶
Information about dependency packages on server.
To download dependency package, use ‘download_dependency_package’ method and pass in ‘filename’.
Example data structure:
{ "packages": [ { "filename": str, "platform": str, "checksum": str, "checksumAlgorithm": str, "size": int, "sources": list[dict[str, Any]], "supportedAddons": dict[str, str], "pythonModules": dict[str, str] } ] }
- Returns:
- Information about dependency packages known for
server.
- Return type:
dict[str, Any]
- get_entities_links(project_name, entity_type, entity_ids=None, link_types=None, link_direction=None, link_names=None, link_name_regex=None)[source]¶
Helper method to get links from server for entity types.
Example output: { "59a212c0d2e211eda0e20242ac120001": [ { "id": "59a212c0d2e211eda0e20242ac120002", "linkType": "reference", "description": "reference link between folders", "projectName": "my_project", "author": "frantadmin", "entityId": "b1df109676db11ed8e8c6c9466b19aa8", "entityType": "folder", "direction": "out" }, ... ], ... }
- Parameters:
project_name (
str
) – Project where links are.(Literal["folder" (entity_type) –
"task" –
"product" –
:param : :param | “version”: Entity type. :param “representations”]): Entity type. :param entity_ids: Ids of entities for which :type entity_ids:
Optional[Iterable[str]]
:param | links should be received.: :param link_types: Link type filters. :type link_types:Optional[Iterable[str]]
:param link_direction: Link direction :type link_direction:Optional[Literal["in", "out"]]
:param | filter.: :param link_names: Link name filters. :type link_names:Optional[Iterable[str]]
:param link_name_regex: Regex filter for link name. :type link_name_regex:Optional[str]
- Returns:
Link info by entity ids.
- Return type:
dict[str, list[dict[str, Any]]]
- get_event(event_id)[source]¶
Query full event data by id.
Events received using event server do not contain full information. To get the full event information is required to receive it explicitly.
- Parameters:
event_id (
str
) – Event id.- Returns:
Full event data.
- Return type:
dict[str, Any]
- get_events(topics=None, event_ids=None, project_names=None, states=None, users=None, include_logs=None, has_children=None, newer_than=None, older_than=None, fields=None)[source]¶
Get events from server with filtering options.
Notes
Not all event happen on a project.
- Parameters:
topics (
Optional[Iterable[str]]
) – Name of topics.event_ids (
Optional[Iterable[str]]
) – Event ids.project_names (
Optional[Iterable[str]]
) – Project on which event happened.states (
Optional[Iterable[str]]
) – Filtering by states.users (
Optional[Iterable[str]]
) – Filtering by users who created/triggered an event.include_logs (
Optional[bool]
) – Query also log events.has_children (
Optional[bool]
) – Event is with/without children events. If ‘None’ then all events are returned, default.newer_than (
Optional[str]
) – Return only events newer than given iso datetime string.older_than (
Optional[str]
) – Return only events older than given iso datetime string.fields (
Optional[Iterable[str]]
) – Fields that should be received for each event.
- Returns:
Available events matching filters.
- Return type:
Generator[dict[str, Any]]
- get_folder_by_id(project_name, folder_id, fields=None, own_attributes=False)[source]¶
Query folder entity by id.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.folder_id (
str
) – Folder id.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
Folder entity data or None if was not found.
- Return type:
Union[dict, None]
- get_folder_by_name(project_name, folder_name, fields=None, own_attributes=False)[source]¶
Query folder entity by path.
Warning
- Folder name is not a unique identifier of a folder. Function is
kept for OpenPype 3 compatibility.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.folder_name (
str
) – Folder name.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
Folder entity data or None if was not found.
- Return type:
Union[dict, None]
- get_folder_by_path(project_name, folder_path, fields=None, own_attributes=False)[source]¶
Query folder entity by path.
Folder path is a path to folder with all parent names joined by slash.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.folder_path (
str
) – Folder path.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
Folder entity data or None if was not found.
- Return type:
Union[dict, None]
- get_folder_ids_with_products(project_name, folder_ids=None)[source]¶
Find folders which have at least one product.
Folders that have at least one product should be immutable, so they should not change path -> change of name or name of any parent is not possible.
- Parameters:
project_name (
str
) – Name of project.folder_ids (
Optional[Iterable[str]]
) – Limit folder ids filtering to a set of folders. If set to None all folders on project are checked.
- Returns:
Folder ids that have at least one product.
- Return type:
set[str]
- get_folder_links(project_name, folder_id, link_types=None, link_direction=None)[source]¶
Query folder links from server.
- Parameters:
project_name (
str
) – Project where links are.folder_id (
str
) – Folder id for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info of folder.
- Return type:
list[dict[str, Any]]
- get_folder_thumbnail(project_name, folder_id, thumbnail_id=None)[source]¶
Prepared method to receive thumbnail for folder entity.
- Parameters:
project_name (
str
) – Project under which the entity is located.folder_id (
str
) – Folder id for which thumbnail should be returned.thumbnail_id (
Optional[str]
) – Prepared thumbnail id from entity. Used only to check if thumbnail was already cached.
- Returns:
- Path to downloaded thumbnail or none if entity
does not have any (or if user does not have permissions).
- Return type:
Union[str, None]
- get_folders(project_name, folder_ids=None, folder_paths=None, folder_names=None, folder_types=None, parent_ids=None, folder_path_regex=None, has_products=None, has_tasks=None, has_children=None, statuses=None, assignees_all=None, tags=None, active=True, has_links=None, fields=None, own_attributes=False)[source]¶
Query folders from server.
- Todos:
- Folder name won’t be unique identifier, so we should add
folder path filtering.
Notes
Filter ‘active’ don’t have direct filter in GraphQl.
- Parameters:
project_name (
str
) – Name of project.folder_ids (
Optional[Iterable[str]]
) – Folder ids to filter.folder_paths (
Optional[Iterable[str]]
) – Folder paths used for filtering.folder_names (
Optional[Iterable[str]]
) – Folder names used for filtering.folder_types (
Optional[Iterable[str]]
) – Folder types used for filtering.parent_ids (
Optional[Iterable[str]]
) – Ids of folder parents. Use ‘None’ if folder is direct child of project.folder_path_regex (
Optional[str]
) – Folder path regex used for filtering.has_products (
Optional[bool]
) – Filter folders with/without products. Ignored when None, default behavior.has_tasks (
Optional[bool]
) – Filter folders with/without tasks. Ignored when None, default behavior.has_children (
Optional[bool]
) – Filter folders with/without children. Ignored when None, default behavior.statuses (
Optional[Iterable[str]]
) – Folder statuses used for filtering.assignees_all (
Optional[Iterable[str]]
) – Filter by assigness on children tasks. Task must have all of passed assignees.tags (
Optional[Iterable[str]]
) – Folder tags used for filtering.active (
Optional[bool]
) – Filter active/inactive folders. Both are returned if is set to None.has_links (
Optional[Literal[IN, OUT, ANY]]
) – Filter representations with IN/OUT/ANY links.fields (
Optional[Iterable[str]]
) – Fields to be queried for folder. All possible folder fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
Queried folder entities.
- Return type:
Generator[dict[str, Any]]
- get_folders_hierarchy(project_name, search_string=None, folder_types=None)[source]¶
Get project hierarchy.
All folders in project in hierarchy data structure.
- Example output:
- {
- “hierarchy”: [
- {
“id”: “…”, “name”: “…”, “label”: “…”, “status”: “…”, “folderType”: “…”, “hasTasks”: False, “taskNames”: [], “parents”: [], “parentId”: None, “children”: […children folders…]
]
}
- Parameters:
project_name (
str
) – Project where to look for folders.search_string (
Optional[str]
) – Search string to filter folders.folder_types (
Optional[Iterable[str]]
) – Folder types to filter.
- Returns:
Response data from server.
- Return type:
dict[str, Any]
- get_folders_links(project_name, folder_ids=None, link_types=None, link_direction=None)[source]¶
Query folders links from server.
- Parameters:
project_name (
str
) – Project where links are.folder_ids (
Optional[Iterable[str]]
) – Ids of folders for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info by folder ids.
- Return type:
dict[str, list[dict[str, Any]]]
- get_folders_rest(project_name, include_attrib=False)[source]¶
Get simplified flat list of all project folders.
- Get all project folders in single REST call. This can be faster than
using ‘get_folders’ method which is using GraphQl, but does not allow any filtering, and set of fields is defined by server backend.
Example:
[ { "id": "112233445566", "parentId": "112233445567", "path": "/root/parent/child", "parents": ["root", "parent"], "name": "child", "label": "Child", "folderType": "Folder", "hasTasks": False, "hasChildren": False, "taskNames": [ "Compositing", ], "status": "In Progress", "attrib": {}, "ownAttrib": [], "updatedAt": "2023-06-12T15:37:02.420260", }, ... ]
- Deprecated:
- Use ‘get_rest_folders’ instead. Function was renamed to match
other rest functions, like ‘get_rest_folder’, ‘get_rest_project’ etc. .
Will be removed in ‘1.0.7’ or ‘1.1.0’.
- Parameters:
project_name (
str
) – Project name.include_attrib (
Optional[bool]
) – Include attribute values in output. Slower to query.
- Returns:
List of folder entities.
- Return type:
list[dict[str, Any]]
- get_full_link_type_name(link_type_name, input_type, output_type)[source]¶
Calculate full link type name used for query from server.
- Parameters:
link_type_name (
str
) – Type of link.input_type (
str
) – Input entity type of link.output_type (
str
) – Output entity type of link.
- Returns:
Full name of link type used for query from server.
- Return type:
str
- get_hero_version_by_id(project_name, version_id, fields=None, own_attributes=<object object>)[source]¶
Query hero version entity by id.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.version_id (
int
) – Hero version id.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for versions.
- Returns:
Version entity data or None if was not found.
- Return type:
Union[dict, None]
- get_hero_version_by_product_id(project_name, product_id, fields=None, own_attributes=<object object>)[source]¶
Query hero version entity by product id.
Only one hero version is available on a product.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.product_id (
int
) – Product id.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for versions.
- Returns:
Version entity data or None if was not found.
- Return type:
Union[dict, None]
- get_hero_versions(project_name, product_ids=None, version_ids=None, active=True, fields=None, own_attributes=<object object>)[source]¶
Query hero versions by multiple filters.
Only one hero version is available on a product.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.product_ids (
Optional[Iterable[str]]
) – Product ids.version_ids (
Optional[Iterable[str]]
) – Version ids.active (
Optional[bool]
) – Receive active/inactive entities. Both are returned when ‘None’ is passed.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for versions.
- Returns:
Version entity data or None if was not found.
- Return type:
Union[dict, None]
- get_info()[source]¶
Get information about current used api key.
By default, the ‘info’ contains only ‘uptime’ and ‘version’. With logged user info also contains information about user and machines on which was logged in.
- Todos:
Use this method for validation of token instead of ‘get_user’.
- Returns:
Information from server.
- Return type:
dict[str, Any]
- get_installers(version=None, platform_name=None)[source]¶
Information about desktop application installers on server.
Desktop application installers are helpers to download/update AYON desktop application for artists.
- Parameters:
version (
Optional[str]
) – Filter installers by version.platform_name (
Optional[str]
) – Filter installers by platform name.
- Return type:
list[dict[str, Any]]
- get_last_version_by_product_id(project_name, product_id, active=True, fields=None, own_attributes=<object object>)[source]¶
Query last version entity by product id.
- Parameters:
project_name (
str
) – Project where to look for representation.product_id (
str
) – Product id.active (
Optional[bool]
) – Receive active/inactive entities. Both are returned when ‘None’ is passed.fields (
Optional[Iterable[str]]
) – fields to be queried for representations.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for versions.
- Returns:
Queried version entity or None.
- Return type:
Union[dict[str, Any], None]
- get_last_version_by_product_name(project_name, product_name, folder_id, active=True, fields=None, own_attributes=<object object>)[source]¶
Query last version entity by product name and folder id.
- Parameters:
project_name (
str
) – Project where to look for representation.product_name (
str
) – Product name.folder_id (
str
) – Folder id.active (
Optional[bool]
) – Receive active/inactive entities. Both are returned when ‘None’ is passed.fields (
Optional[Iterable[str]]
) – fields to be queried for representations.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for representations.
- Returns:
Queried version entity or None.
- Return type:
Union[dict[str, Any], None]
- get_last_versions(project_name, product_ids, active=True, fields=None, own_attributes=<object object>)[source]¶
Query last version entities by product ids.
- Parameters:
project_name (
str
) – Project where to look for representation.product_ids (
Iterable[str]
) – Product ids.active (
Optional[bool]
) – Receive active/inactive entities. Both are returned when ‘None’ is passed.fields (
Optional[Iterable[str]]
) – fields to be queried for representations.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for versions.
- Returns:
Last versions by product id.
- Return type:
dict[str, dict[str, Any]]
- get_link_type(project_name, link_type_name, input_type, output_type)[source]¶
Get link type data.
There is not dedicated REST endpoint to get single link type, so method ‘get_link_types’ is used.
- Example output:
- {
“name”: “reference|folder|folder”, “link_type”: “reference”, “input_type”: “folder”, “output_type”: “folder”, “data”: {}
}
- Parameters:
project_name (
str
) – Project where link type is available.link_type_name (
str
) – Name of link type.input_type (
str
) – Input entity type of link.output_type (
str
) – Output entity type of link.
- Returns:
Link type information.
- Return type:
Union[None, dict[str, Any]]
- get_link_types(project_name)[source]¶
All link types available on a project.
- Example output:
- [
- {
“name”: “reference|folder|folder”, “link_type”: “reference”, “input_type”: “folder”, “output_type”: “folder”, “data”: {}
}
]
- Parameters:
project_name (
str
) – Name of project where to look for link types.- Returns:
Link types available on project.
- Return type:
list[dict[str, Any]]
- get_max_retries()[source]¶
Current value for requests max retries.
- Returns:
Max retries value.
- Return type:
int
- get_product_by_id(project_name, product_id, fields=None, own_attributes=<object object>)[source]¶
Query product entity by id.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.product_id (
str
) – Product id.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for products.
- Returns:
Product entity data or None if was not found.
- Return type:
Union[dict, None]
- get_product_by_name(project_name, product_name, folder_id, fields=None, own_attributes=<object object>)[source]¶
Query product entity by name and folder id.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.product_name (
str
) – Product name.folder_id (
str
) – Folder id (Folder is a parent of products).fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for products.
- Returns:
Product entity data or None if was not found.
- Return type:
Union[dict, None]
- get_product_links(project_name, product_id, link_types=None, link_direction=None)[source]¶
Query product links from server.
- Parameters:
project_name (
str
) – Project where links are.product_id (
str
) – Product id for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info of product.
- Return type:
list[dict[str, Any]]
- get_product_type_names(project_name=None, product_ids=None)[source]¶
Product type names.
Warning
- This function will be probably removed. Matters if ‘products_id’
filter has real use-case.
- Parameters:
project_name (
Optional[str]
) – Name of project where to look for queried entities.product_ids (
Optional[Iterable[str]]
) – Product ids filter. Can be used only with ‘project_name’.
- Returns:
Product type names.
- Return type:
set[str]
- get_product_types(fields=None)[source]¶
Types of products.
- This is server wide information. Product types have ‘name’, ‘icon’ and
‘color’.
- Parameters:
fields (
Optional[Iterable[str]]
) – Product types fields to query.- Returns:
Product types information.
- Return type:
list[dict[str, Any]]
- get_products(project_name, product_ids=None, product_names=None, folder_ids=None, product_types=None, product_name_regex=None, product_path_regex=None, names_by_folder_ids=None, statuses=None, tags=None, active=True, fields=None, own_attributes=<object object>)[source]¶
Query products from server.
- Todos:
- Separate ‘name_by_folder_ids’ filtering to separated method. It
cannot be combined with some other filters.
- Parameters:
project_name (
str
) – Name of project.product_ids (
Optional[Iterable[str]]
) – Task ids to filter.product_names (
Optional[Iterable[str]]
) – Task names used for filtering.folder_ids (
Optional[Iterable[str]]
) – Ids of task parents. Use ‘None’ if folder is direct child of project.product_types (
Optional[Iterable[str]]
) – Product types used for filtering.product_name_regex (
Optional[str]
) – Filter products by name regex.product_path_regex (
Optional[str]
) – Filter products by path regex. Path starts with folder path and ends with product name.names_by_folder_ids (
Optional[dict[str, Iterable[str]]]
) – Product name filtering by folder id.statuses (
Optional[Iterable[str]]
) – Product statuses used for filtering.tags (
Optional[Iterable[str]]
) – Product tags used for filtering.active (
Optional[bool]
) – Filter active/inactive products. Both are returned if is set to None.fields (
Optional[Iterable[str]]
) – Fields to be queried for folder. All possible folder fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for products.
- Returns:
Queried product entities.
- Return type:
Generator[dict[str, Any]]
- get_products_links(project_name, product_ids=None, link_types=None, link_direction=None)[source]¶
Query products links from server.
- Parameters:
project_name (
str
) – Project where links are.product_ids (
Optional[Iterable[str]]
) – Ids of products for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info by product ids.
- Return type:
dict[str, list[dict[str, Any]]]
- get_project(project_name, fields=None, own_attributes=False)[source]¶
Get project.
- Parameters:
project_name (
str
) – Name of project.fields (
Optional[Iterable[str]]
) – fields to be queried for project.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
- Project entity data or None
if project was not found.
- Return type:
Union[dict[str, Any], None]
- get_project_anatomy_preset(preset_name=None)[source]¶
Anatomy preset values by name.
Get anatomy preset values by preset name. Primary preset is returned if preset name is set to ‘None’.
- Parameters:
preset_name (
Optional[str]
) – Preset name.- Returns:
Anatomy preset values.
- Return type:
dict[str, Any]
- get_project_anatomy_presets()[source]¶
Anatomy presets available on server.
Content has basic information about presets. Example output:
[ { "name": "netflix_VFX", "primary": false, "version": "1.0.0" }, { ... }, ... ]
- Returns:
Anatomy presets available on server.
- Return type:
list[dict[str, str]]
- get_project_names(active=True, library=None)[source]¶
Receive available project names.
User must be logged in.
- Parameters:
active (
Optional[bool]
) – Filter active/inactive projects. Both are returned if ‘None’ is passed.library (
Optional[bool]
) – Filter standard/library projects. Both are returned if ‘None’ is passed.
- Returns:
List of available project names.
- Return type:
list[str]
- get_project_product_types(project_name, fields=None)[source]¶
Types of products available on a project.
Filter only product types available on project.
- Parameters:
project_name (
str
) – Name of project where to look for product types.fields (
Optional[Iterable[str]]
) – Product types fields to query.
- Returns:
Product types information.
- Return type:
list[dict[str, Any]]
- get_project_root_overrides(project_name)[source]¶
Root overrides per site name.
- Method is based on logged user and can’t be received for any other
user on server.
Output will contain only roots per site id used by logged user.
- Parameters:
project_name (
str
) – Name of project.- Returns:
Root values by root name by site id.
- Return type:
dict[str, dict[str, str]]
- get_project_root_overrides_by_site_id(project_name, site_id=None)[source]¶
Root overrides for site.
If site id is not passed a site set in current api object is used instead.
- Parameters:
project_name (
str
) – Name of project.site_id (
Optional[str]
) – Site id for which want to receive site overrides.
- Returns:
- Root values by root name or None if
site does not have overrides.
- Return type:
dict[str, str]
- get_project_roots_by_platform(project_name, platform_name=None)[source]¶
Root values for a site.
If platform name is not passed current platform name is used instead.
- This function does return root values without site overrides. It is
possible to use the function to receive default root values.
- Parameters:
project_name (
str
) – Name of project.platform_name (
Optional[Literal["windows", "linux", "darwin"]]
) – Platform name for which want to receive root values. Current platform name is used if not passed.
- Returns:
Root values.
- Return type:
dict[str, str]
- get_project_roots_by_site(project_name)[source]¶
Root overrides per site name.
Method is based on logged user and can’t be received for any other user on server.
Output will contain only roots per site id used by logged user.
- Deprecated:
- Use ‘get_project_root_overrides’ instead. Function
deprecated since 1.0.6
- Parameters:
project_name (
str
) – Name of project.- Returns:
Root values by root name by site id.
- Return type:
dict[str, dict[str, str]]
- get_project_roots_by_site_id(project_name, site_id=None)[source]¶
Root values for a site.
If site id is not passed a site set in current api object is used instead. If site id is not available, default roots are returned for current platform.
- Parameters:
project_name (
str
) – Name of project.site_id (
Optional[str]
) – Site id for which want to receive root values.
- Returns:
Root values.
- Return type:
dict[str, str]
- get_project_roots_for_site(project_name, site_id=None)[source]¶
Root overrides for site.
If site id is not passed a site set in current api object is used instead.
- Deprecated:
- Use ‘get_project_root_overrides_by_site_id’ instead. Function
deprecated since 1.0.6
- Parameters:
project_name (
str
) – Name of project.site_id (
Optional[str]
) – Site id for which want to receive site overrides.
- Returns:
- Root values by root name, root name is not
available if it does not have overrides.
- Return type:
dict[str, str]
- get_projects(active=True, library=None, fields=None, own_attributes=False)[source]¶
Get projects.
- Parameters:
active (
Optional[bool]
) – Filter active or inactive projects. Filter is disabled when ‘None’ is passed.library (
Optional[bool]
) – Filter library projects. Filter is disabled when ‘None’ is passed.fields (
Optional[Iterable[str]]
) – fields to be queried for project.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
Queried projects.
- Return type:
Generator[dict[str, Any]]
- get_repre_ids_by_context_filters(project_name, context_filters, representation_names=None, version_ids=None)[source]¶
Find representation ids which match passed context filters.
Each representation has context integrated on representation entity in database. The context may contain project, folder, task name or product name, product type and many more. This implementation gives option to quickly filter representation based on representation data in database.
- Context filters have defined structure. To define filter of nested
subfield use dot ‘.’ as delimiter (For example ‘task.name’).
- Filter values can be regex filters. String or
re.Pattern
can be used.
- Parameters:
project_name (
str
) – Project where to look for representations.context_filters (
dict[str, list[str]]
) – Filters of context fields.representation_names (
Optional[Iterable[str]]
) – Representation names, can be used as additional filter for representations by their names.version_ids (
Optional[Iterable[str]]
) – Version ids, can be used as additional filter for representations by their parent ids.
- Returns:
Representation ids that match passed filters.
- Return type:
list[str]
Example
- The function returns just representation ids so if entities are
required for funtionality they must be queried afterwards by their ids.
>>> project_name = "testProject" >>> filters = { ... "task.name": ["[aA]nimation"], ... "product": [".*[Mm]ain"] ... } >>> repre_ids = get_repre_ids_by_context_filters( ... project_name, filters) >>> repres = get_representations(project_name, repre_ids)
- get_representation_by_id(project_name, representation_id, fields=None, own_attributes=<object object>)[source]¶
Query representation entity from server based on id filter.
- Parameters:
project_name (
str
) – Project where to look for representation.representation_id (
str
) – Id of representation.fields (
Optional[Iterable[str]]
) – fields to be queried for representations.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for representations.
- Returns:
Queried representation entity or None.
- Return type:
Union[dict[str, Any], None]
- get_representation_by_name(project_name, representation_name, version_id, fields=None, own_attributes=<object object>)[source]¶
Query representation entity by name and version id.
- Parameters:
project_name (
str
) – Project where to look for representation.representation_name (
str
) – Representation name.version_id (
str
) – Version id.fields (
Optional[Iterable[str]]
) – fields to be queried for representations.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for representations.
- Returns:
Queried representation entity or None.
- Return type:
Union[dict[str, Any], None]
- get_representation_hierarchy(project_name, representation_id, project_fields=None, folder_fields=None, task_fields=None, product_fields=None, version_fields=None, representation_fields=None)[source]¶
Find representation parents by representation id.
Representation parent entities up to project.
- Parameters:
project_name (
str
) – Project where to look for entities.representation_id (
str
) – Representation id.project_fields (
Optional[Iterable[str]]
) – Project fields.folder_fields (
Optional[Iterable[str]]
) – Folder fields.task_fields (
Optional[Iterable[str]]
) – Task fields.product_fields (
Optional[Iterable[str]]
) – Product fields.version_fields (
Optional[Iterable[str]]
) – Version fields.representation_fields (
Optional[Iterable[str]]
) – Representation fields.
- Returns:
Representation hierarchy entities.
- Return type:
- get_representation_links(project_name, representation_id, link_types=None, link_direction=None)[source]¶
Query representation links from server.
- Parameters:
project_name (
str
) – Project where links are.representation_id (
str
) – Representation id for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info of representation.
- Return type:
list[dict[str, Any]]
- get_representation_parents(project_name, representation_id, project_fields=None, folder_fields=None, product_fields=None, version_fields=None)[source]¶
Find representation parents by representation id.
Representation parent entities up to project.
- Parameters:
project_name (
str
) – Project where to look for entities.representation_id (
str
) – Representation id.project_fields (
Optional[Iterable[str]]
) – Project fields.folder_fields (
Optional[Iterable[str]]
) – Folder fields.product_fields (
Optional[Iterable[str]]
) – Product fields.version_fields (
Optional[Iterable[str]]
) – Version fields.
- Returns:
Representation parent entities.
- Return type:
- get_representations(project_name, representation_ids=None, representation_names=None, version_ids=None, names_by_version_ids=None, statuses=None, tags=None, active=True, has_links=None, fields=None, own_attributes=<object object>)[source]¶
Get representation entities based on passed filters from server.
- Parameters:
project_name (
str
) – Name of project where to look for versions.representation_ids (
Optional[Iterable[str]]
) – Representation ids used for representation filtering.representation_names (
Optional[Iterable[str]]
) – Representation names used for representation filtering.version_ids (
Optional[Iterable[str]]
) – Version ids used for representation filtering. Versions are parents of representations.names_by_version_ids (
Optional[bool]
) – Find representations by names and version ids. This filter discard all other filters.statuses (
Optional[Iterable[str]]
) – Representation statuses used for filtering.tags (
Optional[Iterable[str]]
) – Representation tags used for filtering.active (
Optional[bool]
) – Receive active/inactive entities. Both are returned when ‘None’ is passed.has_links (
Optional[Literal[IN, OUT, ANY]]
) – Filter representations with IN/OUT/ANY links.fields (
Optional[Iterable[str]]
) – Fields to be queried for representation. All possible fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for representations.
- Returns:
Queried representation entities.
- Return type:
Generator[dict[str, Any]]
- get_representations_hierarchy(project_name, representation_ids, project_fields=None, folder_fields=None, task_fields=None, product_fields=None, version_fields=None, representation_fields=None)[source]¶
Find representation with parents by representation id.
Representation entity with parent entities up to project.
- Default fields are used when any fields are set to None. But it is
possible to pass in empty iterable (list, set, tuple) to skip entity.
- Parameters:
project_name (
str
) – Project where to look for entities.representation_ids (
Iterable[str]
) – Representation ids.project_fields (
Optional[Iterable[str]]
) – Project fields.folder_fields (
Optional[Iterable[str]]
) – Folder fields.task_fields (
Optional[Iterable[str]]
) – Task fields.product_fields (
Optional[Iterable[str]]
) – Product fields.version_fields (
Optional[Iterable[str]]
) – Version fields.representation_fields (
Optional[Iterable[str]]
) – Representation fields.
- Returns:
- Parent entities by
representation id.
- Return type:
dict[str, RepresentationHierarchy]
- get_representations_links(project_name, representation_ids=None, link_types=None, link_direction=None)[source]¶
Query representations links from server.
- Parameters:
project_name (
str
) – Project where links are.representation_ids (
Optional[Iterable[str]]
) – Ids of representations for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info by representation ids.
- Return type:
dict[str, list[dict[str, Any]]]
- get_representations_parents(project_name, representation_ids, project_fields=None, folder_fields=None, product_fields=None, version_fields=None)[source]¶
Find representations parents by representation id.
Representation parent entities up to project.
- Parameters:
project_name (
str
) – Project where to look for entities.representation_ids (
Iterable[str]
) – Representation ids.project_fields (
Optional[Iterable[str]]
) – Project fields.folder_fields (
Optional[Iterable[str]]
) – Folder fields.product_fields (
Optional[Iterable[str]]
) – Product fields.version_fields (
Optional[Iterable[str]]
) – Version fields.
- Returns:
- Parent entities by
representation id.
- Return type:
dict[str, RepresentationParents]
- get_rest_entity_by_id(project_name, entity_type, entity_id)[source]¶
Get entity using REST on a project by its id.
- Parameters:
project_name (
str
) – Name of project where entity is.entity_type (
Literal["folder", "task", "product", "version"]
) – The entity type which should be received.entity_id (
str
) – Id of entity.
- Returns:
Received entity data.
- Return type:
dict[str, Any]
- get_rest_folders(project_name, include_attrib=False)[source]¶
Get simplified flat list of all project folders.
- Get all project folders in single REST call. This can be faster than
using ‘get_folders’ method which is using GraphQl, but does not allow any filtering, and set of fields is defined by server backend.
Example:
[ { "id": "112233445566", "parentId": "112233445567", "path": "/root/parent/child", "parents": ["root", "parent"], "name": "child", "label": "Child", "folderType": "Folder", "hasTasks": False, "hasChildren": False, "taskNames": [ "Compositing", ], "status": "In Progress", "attrib": {}, "ownAttrib": [], "updatedAt": "2023-06-12T15:37:02.420260", }, ... ]
- Parameters:
project_name (
str
) – Project name.include_attrib (
Optional[bool]
) – Include attribute values in output. Slower to query.
- Returns:
List of folder entities.
- Return type:
list[dict[str, Any]]
- get_rest_project(project_name)[source]¶
Query project by name.
This call returns project with anatomy data.
- Parameters:
project_name (
str
) – Name of project.- Returns:
- Project entity data or ‘None’ if
project was not found.
- Return type:
Union[dict[str, Any], None]
- get_rest_projects(active=True, library=None)[source]¶
Query available project entities.
User must be logged in.
- Parameters:
active (
Optional[bool]
) – Filter active/inactive projects. Both are returned if ‘None’ is passed.library (
Optional[bool]
) – Filter standard/library projects. Both are returned if ‘None’ is passed.
- Returns:
Available projects.
- Return type:
Generator[dict[str, Any]]
- get_schemas()[source]¶
Get components schema.
Name of components does not match entity type names e.g. ‘project’ is under ‘ProjectModel’. We should find out some mapping. Also, there are properties which don’t have information about reference to object e.g. ‘config’ has just object definition without reference schema.
- Returns:
Component schemas.
- Return type:
dict[str, Any]
- get_secret(secret_name)[source]¶
Get secret by name.
Example output:
{ "name": "secret_name", "value": "secret_value", }
- Parameters:
secret_name (
str
) – Name of secret.- Returns:
Secret entity data.
- Return type:
dict[str, str]
- get_secrets()[source]¶
Get all secrets.
Example output:
[ { "name": "secret_1", "value": "secret_value_1", }, { "name": "secret_2", "value": "secret_value_2", } ]
- Returns:
List of secret entities.
- Return type:
list[dict[str, str]]
- get_sender()[source]¶
Sender used to send requests.
- Returns:
Sender name or None.
- Return type:
Union[str, None]
- get_server_schema()[source]¶
Get server schema with info, url paths, components etc.
- Todos:
Cache schema - How to find out it is outdated?
- Returns:
Full server schema.
- Return type:
dict[str, Any]
- get_server_version()[source]¶
Get server version.
Version should match semantic version (https://semver.org/).
- Returns:
Server version.
- Return type:
str
- get_server_version_tuple()[source]¶
Get server version as tuple.
Version should match semantic version (https://semver.org/).
This function only returns first three numbers of version.
- Returns:
- Server
version.
- Return type:
Tuple[int, int, int, Union[str, None], Union[str, None]]
- get_site_id()[source]¶
Site id used for connection.
Site id tells server from which machine/site is connection created and is used for default site overrides when settings are received.
- Returns:
Site id value or None if not filled.
- Return type:
Union[str, None]
- get_ssl_verify()[source]¶
Enable ssl verification.
- Returns:
Current state of ssl verification.
- Return type:
bool
- get_task_by_folder_path(project_name, folder_path, task_name, fields=None, own_attributes=False)[source]¶
Query task entity by folder path and task name.
- Parameters:
project_name (
str
) – Project name.folder_path (
str
) – Folder path.task_name (
str
) – Task name.fields (
Optional[Iterable[str]]
) – Task fields that should be returned.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
- Task entity data or None if was
not found.
- Return type:
Union[dict[str, Any], None]
- get_task_by_id(project_name, task_id, fields=None, own_attributes=False)[source]¶
Query task entity by id.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.task_id (
str
) – Task id.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
Task entity data or None if was not found.
- Return type:
Union[dict, None]
- get_task_by_name(project_name, folder_id, task_name, fields=None, own_attributes=False)[source]¶
Query task entity by name and folder id.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.folder_id (
str
) – Folder id.task_name (
str
) – Task namefields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
Task entity data or None if was not found.
- Return type:
Union[dict, None]
- get_task_links(project_name, task_id, link_types=None, link_direction=None)[source]¶
Query task links from server.
- Parameters:
project_name (
str
) – Project where links are.task_id (
str
) – Task id for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info of task.
- Return type:
list[dict[str, Any]]
- get_tasks(project_name, task_ids=None, task_names=None, task_types=None, folder_ids=None, assignees=None, assignees_all=None, statuses=None, tags=None, active=True, fields=None, own_attributes=False)[source]¶
Query task entities from server.
- Parameters:
project_name (
str
) – Name of project.task_ids (
Iterable[str]
) – Task ids to filter.task_names (
Iterable[str]
) – Task names used for filtering.task_types (
Iterable[str]
) – Task types used for filtering.folder_ids (
Iterable[str]
) – Ids of task parents. Use ‘None’ if folder is direct child of project.assignees (
Optional[Iterable[str]]
) – Task assignees used for filtering. All tasks with any of passed assignees are returned.assignees_all (
Optional[Iterable[str]]
) – Task assignees used for filtering. Task must have all of passed assignees to be returned.statuses (
Optional[Iterable[str]]
) – Task statuses used for filtering.tags (
Optional[Iterable[str]]
) – Task tags used for filtering.active (
Optional[bool]
) – Filter active/inactive tasks. Both are returned if is set to None.fields (
Optional[Iterable[str]]
) – Fields to be queried for folder. All possible folder fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
Queried task entities.
- Return type:
Generator[dict[str, Any]]
- get_tasks_by_folder_path(project_name, folder_path, task_names=None, task_types=None, assignees=None, assignees_all=None, statuses=None, tags=None, active=True, fields=None, own_attributes=False)[source]¶
Query task entities from server by folder path.
- Parameters:
project_name (
str
) – Name of project.folder_path (
str
) – Folder path.task_names (
Iterable[str]
) – Task names used for filtering.task_types (
Iterable[str]
) – Task types used for filtering.assignees (
Optional[Iterable[str]]
) – Task assignees used for filtering. All tasks with any of passed assignees are returned.assignees_all (
Optional[Iterable[str]]
) – Task assignees used for filtering. Task must have all of passed assignees to be returned.statuses (
Optional[Iterable[str]]
) – Task statuses used for filtering.tags (
Optional[Iterable[str]]
) – Task tags used for filtering.active (
Optional[bool]
) – Filter active/inactive tasks. Both are returned if is set to None.fields (
Optional[Iterable[str]]
) – Fields to be queried for folder. All possible folder fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- get_tasks_by_folder_paths(project_name, folder_paths, task_names=None, task_types=None, assignees=None, assignees_all=None, statuses=None, tags=None, active=True, fields=None, own_attributes=False)[source]¶
Query task entities from server by folder paths.
- Parameters:
project_name (
str
) – Name of project.folder_paths (
list[str]
) – Folder paths.task_names (
Iterable[str]
) – Task names used for filtering.task_types (
Iterable[str]
) – Task types used for filtering.assignees (
Optional[Iterable[str]]
) – Task assignees used for filtering. All tasks with any of passed assignees are returned.assignees_all (
Optional[Iterable[str]]
) – Task assignees used for filtering. Task must have all of passed assignees to be returned.statuses (
Optional[Iterable[str]]
) – Task statuses used for filtering.tags (
Optional[Iterable[str]]
) – Task tags used for filtering.active (
Optional[bool]
) – Filter active/inactive tasks. Both are returned if is set to None.fields (
Optional[Iterable[str]]
) – Fields to be queried for folder. All possible folder fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
- Task entities by
folder path.
- Return type:
dict[dict[str, list[dict[str, Any]]]
- get_tasks_links(project_name, task_ids=None, link_types=None, link_direction=None)[source]¶
Query tasks links from server.
- Parameters:
project_name (
str
) – Project where links are.task_ids (
Optional[Iterable[str]]
) – Ids of tasks for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info by task ids.
- Return type:
dict[str, list[dict[str, Any]]]
- get_thumbnail(project_name, entity_type, entity_id, thumbnail_id=None)[source]¶
Get thumbnail from server.
Permissions of thumbnails are related to entities so thumbnails must be queried per entity. So an entity type and entity type is required to be passed.
Notes
- It is recommended to use one of prepared entity type specific
methods ‘get_folder_thumbnail’, ‘get_version_thumbnail’ or ‘get_workfile_thumbnail’.
- We do recommend pass thumbnail id if you have access to it. Each
entity that allows thumbnails has ‘thumbnailId’ field, so it can be queried.
- Parameters:
project_name (
str
) – Project under which the entity is located.entity_type (
str
) – Entity type which passed entity id represents.entity_id (
str
) – Entity id for which thumbnail should be returned.thumbnail_id (
Optional[str]
) – DEPRECATED Use ‘get_thumbnail_by_id’.
- Returns:
- Thumbnail content wrapper. Does not have to be
valid.
- Return type:
- get_thumbnail_by_id(project_name, thumbnail_id)[source]¶
Get thumbnail from server by id.
Permissions of thumbnails are related to entities so thumbnails must be queried per entity. So an entity type and entity type is required to be passed.
Notes
- It is recommended to use one of prepared entity type specific
methods ‘get_folder_thumbnail’, ‘get_version_thumbnail’ or ‘get_workfile_thumbnail’.
- We do recommend pass thumbnail id if you have access to it. Each
entity that allows thumbnails has ‘thumbnailId’ field, so it can be queried.
- Parameters:
project_name (
str
) – Project under which the entity is located.thumbnail_id (
Optional[str]
) – DEPRECATED Use ‘get_thumbnail_by_id’.
- Returns:
- Thumbnail content wrapper. Does not have to be
valid.
- Return type:
- get_timeout()[source]¶
Current value for requests timeout.
- Returns:
Timeout value in seconds.
- Return type:
float
- get_user(username=None)[source]¶
Get user info using REST endpoit.
- Parameters:
username (
Optional[str]
) – Username.- Returns:
- User info or None if user is not
found.
- Return type:
Union[dict[str, Any], None]
- get_user_by_name(username, project_name=None, fields=None)[source]¶
Get user by name using GraphQl.
- Only administrators and managers can fetch all users. For other users
it is required to pass in ‘project_name’ filter.
- Parameters:
username (
str
) – Username.project_name (
Optional[str]
) – Define scope of project.fields (
Optional[Iterable[str]]
) – Fields to be queried for users.
- Returns:
- User info or None if user is not
found.
- Return type:
Union[dict[str, Any], None]
- get_users(project_name=None, usernames=None, fields=None)[source]¶
Get Users.
- Only administrators and managers can fetch all users. For other users
it is required to pass in ‘project_name’ filter.
- Parameters:
project_name (
Optional[str]
) – Project name.usernames (
Optional[Iterable[str]]
) – Filter by usernames.fields (
Optional[Iterable[str]]
) – Fields to be queried for users.
- Returns:
Queried users.
- Return type:
Generator[dict[str, Any]]
- get_version_by_id(project_name, version_id, fields=None, own_attributes=<object object>)[source]¶
Query version entity by id.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.version_id (
str
) – Version id.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for versions.
- Returns:
Version entity data or None if was not found.
- Return type:
Union[dict, None]
- get_version_by_name(project_name, version, product_id, fields=None, own_attributes=<object object>)[source]¶
Query version entity by version and product id.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.version (
int
) – Version of version entity.product_id (
str
) – Product id. Product is a parent of version.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for versions.
- Returns:
Version entity data or None if was not found.
- Return type:
Union[dict, None]
- get_version_links(project_name, version_id, link_types=None, link_direction=None)[source]¶
Query version links from server.
- Parameters:
project_name (
str
) – Project where links are.version_id (
str
) – Version id for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info of version.
- Return type:
list[dict[str, Any]]
- get_version_thumbnail(project_name, version_id, thumbnail_id=None)[source]¶
Prepared method to receive thumbnail for version entity.
- Parameters:
project_name (
str
) – Project under which the entity is located.version_id (
str
) – Version id for which thumbnail should be returned.thumbnail_id (
Optional[str]
) – Prepared thumbnail id from entity. Used only to check if thumbnail was already cached.
- Returns:
- Path to downloaded thumbnail or none if entity
does not have any (or if user does not have permissions).
- Return type:
Union[str, None]
- get_versions(project_name, version_ids=None, product_ids=None, task_ids=None, versions=None, hero=True, standard=True, latest=None, statuses=None, tags=None, active=True, fields=None, own_attributes=<object object>)[source]¶
Get version entities based on passed filters from server.
- Parameters:
project_name (
str
) – Name of project where to look for versions.version_ids (
Optional[Iterable[str]]
) – Version ids used for version filtering.product_ids (
Optional[Iterable[str]]
) – Product ids used for version filtering.task_ids (
Optional[Iterable[str]]
) – Task ids used for version filtering.versions (
Optional[Iterable[int]]
) – Versions we’re interested in.hero (
Optional[bool]
) – Skip hero versions when set to False.standard (
Optional[bool]
) – Skip standard (non-hero) when set to False.latest (
Optional[bool]
) – Return only latest version of standard versions. This can be combined only with ‘standard’ attribute set to True.statuses (
Optional[Iterable[str]]
) – Representation statuses used for filtering.tags (
Optional[Iterable[str]]
) – Representation tags used for filtering.active (
Optional[bool]
) – Receive active/inactive entities. Both are returned when ‘None’ is passed.fields (
Optional[Iterable[str]]
) – Fields to be queried for version. All possible folder fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for versions.
- Returns:
Queried version entities.
- Return type:
Generator[dict[str, Any]]
- get_versions_links(project_name, version_ids=None, link_types=None, link_direction=None)[source]¶
Query versions links from server.
- Parameters:
project_name (
str
) – Project where links are.version_ids (
Optional[Iterable[str]]
) – Ids of versions for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info by version ids.
- Return type:
dict[str, list[dict[str, Any]]]
- get_workfile_info(project_name, task_id, path, fields=None, own_attributes=<object object>)[source]¶
Workfile info entity by task id and workfile path.
- Parameters:
project_name (
str
) – Project under which the entity is located.task_id (
str
) – Task id.path (
str
) – Rootless workfile path.fields (
Optional[Iterable[str]]
) – Fields to be queried for representation. All possible fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for workfiles.
- Returns:
Workfile info entity or None.
- Return type:
Union[dict[str, Any], None]
- get_workfile_info_by_id(project_name, workfile_id, fields=None, own_attributes=<object object>)[source]¶
Workfile info entity by id.
- Parameters:
project_name (
str
) – Project under which the entity is located.workfile_id (
str
) – Workfile info id.fields (
Optional[Iterable[str]]
) – Fields to be queried for representation. All possible fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for workfiles.
- Returns:
Workfile info entity or None.
- Return type:
Union[dict[str, Any], None]
- get_workfile_thumbnail(project_name, workfile_id, thumbnail_id=None)[source]¶
Prepared method to receive thumbnail for workfile entity.
- Parameters:
project_name (
str
) – Project under which the entity is located.workfile_id (
str
) – Worfile id for which thumbnail should be returned.thumbnail_id (
Optional[str]
) – Prepared thumbnail id from entity. Used only to check if thumbnail was already cached.
- Returns:
- Path to downloaded thumbnail or none if entity
does not have any (or if user does not have permissions).
- Return type:
Union[str, None]
- get_workfiles_info(project_name, workfile_ids=None, task_ids=None, paths=None, path_regex=None, statuses=None, tags=None, has_links=None, fields=None, own_attributes=<object object>)[source]¶
Workfile info entities by passed filters.
- Parameters:
project_name (
str
) – Project under which the entity is located.workfile_ids (
Optional[Iterable[str]]
) – Workfile ids.task_ids (
Optional[Iterable[str]]
) – Task ids.paths (
Optional[Iterable[str]]
) – Rootless workfiles paths.path_regex (
Optional[str]
) – Regex filter for workfile path.statuses (
Optional[Iterable[str]]
) – Workfile info statuses used for filtering.tags (
Optional[Iterable[str]]
) – Workfile info tags used for filtering.has_links (
Optional[Literal[IN, OUT, ANY]]
) – Filter representations with IN/OUT/ANY links.fields (
Optional[Iterable[str]]
) – Fields to be queried for representation. All possible fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for workfiles.
- Returns:
Queried workfile info entites.
- Return type:
Generator[dict[str, Any]]
- property graphql_allows_data_in_query¶
GraphQl query can support ‘data’ field.
This applies only to project hierarchy entities ‘project’, ‘folder’, ‘task’, ‘product’, ‘version’ and ‘representation’. Others like ‘user’ still require to use rest api to access ‘data’.
- Returns:
True if server supports ‘data’ field in GraphQl query.
- Return type:
bool
- property has_valid_token¶
- property is_server_available¶
- is_service_user()[source]¶
Check if connection is using service API key.
- Returns:
Used api key belongs to service user.
- Return type:
bool
- property log¶
- login(username, password, create_session=True)[source]¶
Login to server.
- Parameters:
username (
str
) – Username.password (
str
) – Password.create_session (
Optional[bool]
) – Create session after login. Default: True.
- Raises:
AuthenticationError – Login failed.
- make_sure_link_type_exists(project_name, link_type_name, input_type, output_type, data=None)[source]¶
Make sure link type exists on a project.
- Parameters:
project_name (
str
) – Name of project.link_type_name (
str
) – Name of link type.input_type (
str
) – Input entity type of link.output_type (
str
) – Output entity type of link.data (
Optional[dict[str, Any]]
) – Link type related data.
- property max_retries¶
Current value for requests max retries.
- Returns:
Max retries value.
- Return type:
int
- query_graphql(query, variables=None)[source]¶
Execute GraphQl query.
- Parameters:
query (
str
) – GraphQl query string.variables (
Optional[dict[str, Any]
) – Variables that can be used in query.
- Returns:
Response from server.
- Return type:
- remove_attribute_config(attribute_name)[source]¶
Remove attribute from server.
This can’t be un-done, please use carefully.
- Parameters:
attribute_name (
str
) – Name of attribute to remove.
- property rest_url¶
- save_secret(secret_name, secret_value)[source]¶
Save secret.
This endpoint can create and update secret.
- Parameters:
secret_name (
str
) – Name of secret.secret_value (
str
) – Value of secret.
- send_batch_operations(project_name, operations, can_fail=False, raise_on_fail=True)[source]¶
Post multiple CRUD operations to server.
When multiple changes should be made on server side this is the best way to go. It is possible to pass multiple operations to process on a server side and do the changes in a transaction.
- Parameters:
project_name (
str
) – On which project should be operations processed.operations (
list[dict[str, Any]]
) – Operations to be processed.can_fail (
Optional[bool]
) – Server will try to process all operations even if one of them fails.raise_on_fail (
Optional[bool]
) – Raise exception if an operation fails. You can handle failed operations on your own when set to ‘False’.
- Raises:
ValueError – Operations can’t be converted to json string.
FailedOperations – When output does not contain server operations or ‘raise_on_fail’ is enabled and any operation fails.
- Returns:
Operations result with process details.
- Return type:
list[dict[str, Any]]
- property sender¶
Sender used to send requests.
- Returns:
Sender name or None.
- Return type:
Union[str, None]
- property server_version¶
Get server version.
Version should match semantic version (https://semver.org/).
- Returns:
Server version.
- Return type:
str
- property server_version_tuple¶
Get server version as tuple.
Version should match semantic version (https://semver.org/).
This function only returns first three numbers of version.
- Returns:
- Server
version.
- Return type:
Tuple[int, int, int, Union[str, None], Union[str, None]]
- set_cert(cert)[source]¶
Change cert file used for connection to server.
- Parameters:
cert (
Union[str, None]
) – Path to cert file.
- set_client_version(client_version)[source]¶
Set version of client used to connect to server.
Client version is AYON client build desktop application.
- Parameters:
client_version (
Union[str, None]
) – Client version string.
- set_default_service_username(username=None)[source]¶
Service API will work as other user.
Service API keys can work as other user. It can be temporary using context manager ‘as_user’ or it is possible to set default username if ‘as_user’ context manager is not entered.
- Parameters:
username (
Optional[str]
) – Username to work as when service.- Raises:
ValueError – When connection is not yet authenticated or api key is not service token.
- set_default_settings_variant(variant)[source]¶
Change default variant for addon settings.
Note
- It is recommended to set only ‘production’ or ‘staging’ variants
as default variant.
- Parameters:
variant (
str
) – Settings variant name. It is possible to use ‘production’, ‘staging’ or name of dev bundle.
- set_max_retries(max_retries)[source]¶
Change max retries value for requests.
- Parameters:
max_retries (
Union[int, None]
) – Max retries value.
- set_sender(sender)[source]¶
Change sender used for requests.
- Parameters:
sender (
Union[str, None]
) – Sender name or None.
- set_site_id(site_id)[source]¶
Change site id of connection.
Behave as specific site for server. It affects default behavior of settings getter methods.
- Parameters:
site_id (
Union[str, None]
) – Site id value, or ‘None’ to unset.
- set_ssl_verify(ssl_verify)[source]¶
Change ssl verification state.
- Parameters:
ssl_verify (
Union[bool, str, None]
) – Enabled/disable ssl verification, can be a path to file.
- set_timeout(timeout)[source]¶
Change timeout value for requests.
- Parameters:
timeout (
Union[float, None]
) – Timeout value in seconds.
- property site_id¶
Site id used for connection.
Site id tells server from which machine/site is connection created and is used for default site overrides when settings are received.
- Returns:
Site id value or None if not filled.
- Return type:
Union[str, None]
- property ssl_verify¶
Enable ssl verification.
- Returns:
Current state of ssl verification.
- Return type:
bool
- property timeout¶
Current value for requests timeout.
- Returns:
Timeout value in seconds.
- Return type:
float
- trigger_server_restart()[source]¶
Trigger server restart.
Restart may be required when a change of specific value happened on server.
- update_bundle(bundle_name, addon_versions=None, installer_version=None, dependency_packages=None, is_production=None, is_staging=None, is_dev=None, dev_active_user=None, dev_addons_config=None)[source]¶
Update bundle on server.
Dependency packages can be update only for single platform. Others will be left untouched. Use ‘None’ value to unset dependency package from bundle.
- Parameters:
bundle_name (
str
) – Name of bundle.addon_versions (
Optional[dict[str, str]]
) – Addon versions, possible only for dev bundles.installer_version (
Optional[str]
) – Installer version, possible only for dev bundles.dependency_packages (
Optional[dict[str, str]]
) – Dependency pacakge names that should be used with the bundle.is_production (
Optional[bool]
) – Bundle will be marked as production.is_staging (
Optional[bool]
) – Bundle will be marked as staging.is_dev (
Optional[bool]
) – Bundle will be marked as dev.dev_active_user (
Optional[str]
) – Username that will be assigned to dev bundle. Can be used only for dev bundles.dev_addons_config (
Optional[dict[str, Any]]
) – Configuration for dev addons. Can be used only for dev bundles.
- update_dependency_package(filename, sources)[source]¶
Update dependency package metadata on server.
- Parameters:
filename (
str
) – Filename of dependency package.sources (
list[dict[str, Any]]
) – Information about sources from where it is possible to get file. Fully replaces existing sources.
- update_event(event_id, sender=None, project_name=None, username=None, status=None, description=None, summary=None, payload=None, progress=None, retries=None)[source]¶
Update event data.
- Parameters:
event_id (
str
) – Event id.sender (
Optional[str]
) – New sender of event.project_name (
Optional[str]
) – New project name.username (
Optional[str]
) – New username.status (
Optional[str]
) – New event status. Enum: “pending”, “in_progress”, “finished”, “failed”, “aborted”, “restarted”description (
Optional[str]
) – New description.summary (
Optional[dict[str, Any]]
) – New summary.payload (
Optional[dict[str, Any]]
) – New payload.progress (
Optional[int]
) – New progress. Range [0-100].retries (
Optional[int]
) – New retries.
- update_folder(project_name, folder_id, name=None, folder_type=None, parent_id=<object object>, label=<object object>, attrib=None, data=None, tags=None, status=None, active=None, thumbnail_id=<object object>)[source]¶
Update folder entity on server.
- Do not pass
parent_id
,label
amdthumbnail_id
if you don’t want to change their values. Value
None
would unset their value.
Update of
data
will override existing value on folder entity.- Update of
attrib
does change only passed attributes. If you want to unset value, use
None
.
- Parameters:
project_name (
str
) – Project name.folder_id (
str
) – Folder id.name (
Optional[str]
) – New name.folder_type (
Optional[str]
) – New folder type.parent_id (
Optional[Union[str, None]]
) – New parent folder id.label (
Optional[Union[str, None]]
) – New label.attrib (
Optional[dict[str, Any]]
) – New attributes.data (
Optional[dict[str, Any]]
) – New data.tags (
Optional[Iterable[str]]
) – New tags.status (
Optional[str]
) – New status.active (
Optional[bool]
) – New active state.thumbnail_id (
Optional[Union[str, None]]
) – New thumbnail id.
- Do not pass
- update_installer(filename, sources)[source]¶
Update installer information on server.
- Parameters:
filename (
str
) – Installer filename.sources (
list[dict[str, Any]]
) – List of sources that can be used to download file. Fully replaces existing sources.
- update_product(project_name, product_id, name=None, folder_id=None, product_type=None, attrib=None, data=None, tags=None, status=None, active=None)[source]¶
Update product entity on server.
Update of
data
will override existing value on folder entity.- Update of
attrib
does change only passed attributes. If you want to unset value, use
None
.
- Parameters:
project_name (
str
) – Project name.product_id (
str
) – Product id.name (
Optional[str]
) – New product name.folder_id (
Optional[str]
) – New product id.product_type (
Optional[str]
) – New product type.attrib (
Optional[dict[str, Any]]
) – New product attributes.data (
Optional[dict[str, Any]]
) – New product data.tags (
Optional[Iterable[str]]
) – New product tags.status (
Optional[str]
) – New product status.active (
Optional[bool]
) – New product active state.
- Update of
- update_project(project_name, library=None, folder_types=None, task_types=None, link_types=None, statuses=None, tags=None, config=None, attrib=None, data=None, active=None, project_code=None, **changes)[source]¶
Update project entity on server.
- Parameters:
project_name (
str
) – Name of project.library (
Optional[bool]
) – Change library state.folder_types (
Optional[list[dict[str, Any]]]
) – Folder type definitions.task_types (
Optional[list[dict[str, Any]]]
) – Task type definitions.link_types (
Optional[list[dict[str, Any]]]
) – Link type definitions.statuses (
Optional[list[dict[str, Any]]]
) – Status definitions.tags (
Optional[list[dict[str, Any]]]
) – List of tags available to set on entities.config (
Optional[dict[dict[str, Any]]]
) – Project anatomy config with templates and roots.attrib (
Optional[dict[str, Any]]
) – Project attributes to change.data (
Optional[dict[str, Any]]
) – Custom data of a project. This value will 100% override project data.active (
Optional[bool]
) – Change active state of a project.project_code (
Optional[str]
) – Change project code. Not recommended during production.**changes – Other changed keys based on Rest API documentation.
- update_representation(project_name, representation_id, name=None, version_id=None, files=None, attrib=None, data=None, tags=None, status=None, active=None)[source]¶
Update representation entity on server.
Update of
data
will override existing value on folder entity.- Update of
attrib
does change only passed attributes. If you want to unset value, use
None
.
- Parameters:
project_name (
str
) – Project name.representation_id (
str
) – Representation id.name (
Optional[str]
) – New name.version_id (
Optional[str]
) – New version id.files (
Optional[list[dict]]
) – New files information.attrib (
Optional[dict[str, Any]]
) – New attributes.data (
Optional[dict[str, Any]]
) – New data.tags (
Optional[Iterable[str]]
) – New tags.status (
Optional[str]
) – New status.active (
Optional[bool]
) – New active state.
- Update of
- update_task(project_name, task_id, name=None, task_type=None, folder_id=None, label=<object object>, assignees=None, attrib=None, data=None, tags=None, status=None, active=None, thumbnail_id=<object object>)[source]¶
Update task entity on server.
- Do not pass
label
amdthumbnail_id
if you don’t want to change their values. Value
None
would unset their value.
Update of
data
will override existing value on folder entity.- Update of
attrib
does change only passed attributes. If you want to unset value, use
None
.
- Parameters:
project_name (
str
) – Project name.task_id (
str
) – Task id.name (
Optional[str]
) – New name.task_type (
Optional[str]
) – New task type.folder_id (
Optional[str]
) – New folder id.label (
Optional[Union[str, None]]
) – New label.assignees (
Optional[str]
) – New assignees.attrib (
Optional[dict[str, Any]]
) – New attributes.data (
Optional[dict[str, Any]]
) – New data.tags (
Optional[Iterable[str]]
) – New tags.status (
Optional[str]
) – New status.active (
Optional[bool]
) – New active state.thumbnail_id (
Optional[Union[str, None]]
) – New thumbnail id.
- Do not pass
- update_thumbnail(project_name, thumbnail_id, src_filepath)[source]¶
Change thumbnail content by id.
Update can be also used to create new thumbnail.
- Parameters:
project_name (
str
) – Project where the thumbnail will be created and can be used.thumbnail_id (
str
) – Thumbnail id to update.src_filepath (
str
) – Filepath to thumbnail which should be uploaded.
- Raises:
ValueError – When thumbnail source cannot be processed.
- update_version(project_name, version_id, version=None, product_id=None, task_id=<object object>, author=None, attrib=None, data=None, tags=None, status=None, active=None, thumbnail_id=<object object>)[source]¶
Update version entity on server.
- Do not pass
task_id
amdthumbnail_id
if you don’t want to change their values. Value
None
would unset their value.
Update of
data
will override existing value on folder entity.- Update of
attrib
does change only passed attributes. If you want to unset value, use
None
.
- Parameters:
project_name (
str
) – Project name.version_id (
str
) – Version id.version (
Optional[int]
) – New version.product_id (
Optional[str]
) – New product id.task_id (
Optional[Union[str, None]]
) – New task id.author (
Optional[str]
) – New author username.attrib (
Optional[dict[str, Any]]
) – New attributes.data (
Optional[dict[str, Any]]
) – New data.tags (
Optional[Iterable[str]]
) – New tags.status (
Optional[str]
) – New status.active (
Optional[bool]
) – New active state.thumbnail_id (
Optional[Union[str, None]]
) – New thumbnail id.
- Do not pass
- upload_addon_zip(src_filepath, progress=None)[source]¶
Upload addon zip file to server.
- File is validated on server. If it is valid, it is installed. It will
create an event job which can be tracked (tracking part is not implemented yet).
Example output:
{'eventId': 'a1bfbdee27c611eea7580242ac120003'}
- Parameters:
src_filepath (
str
) – Path to a zip file.progress (
Optional[TransferProgress]
) – Object to keep track about upload state.
- Returns:
Response data from server.
- Return type:
dict[str, Any]
- upload_dependency_package(src_filepath, dst_filename, platform_name=None, progress=None)[source]¶
Upload dependency package to server.
- Parameters:
src_filepath (
str
) – Path to a package file.dst_filename (
str
) – Dependency package filename or name of package for server version 0.2.0 or lower. Must be unique.platform_name (
Optional[str]
) – Deprecated.progress (
Optional[TransferProgress]
) – Object to keep track about upload state.
- upload_file(endpoint, filepath, progress=None, request_type=None, **kwargs)[source]¶
Upload file to server.
- Todos:
Use retries and timeout. Return RestApiResponse.
- Parameters:
endpoint (
str
) – Endpoint or url where file will be uploaded.filepath (
str
) – Source filepath.progress (
Optional[TransferProgress]
) – Object that gives ability to track upload progress.request_type (
Optional[RequestType]
) – Type of request that will be used to upload file.**kwargs (
Any
) – Additional arguments that will be passed to request function.
- Returns:
Response object
- Return type:
requests.Response
- upload_file_from_stream(endpoint, stream, progress, request_type, **kwargs)[source]¶
Upload file to server from bytes.
- Todos:
Use retries and timeout. Return RestApiResponse.
- Parameters:
endpoint (
str
) – Endpoint or url where file will be uploaded.stream (
Union[io.BytesIO, BinaryIO]
) – File content stream.progress (
Optional[TransferProgress]
) – Object that gives ability to track upload progress.request_type (
Optional[RequestType]
) – Type of request that will be used to upload file.**kwargs (
Any
) – Additional arguments that will be passed to request function.
- Returns:
Response object
- Return type:
requests.Response
- upload_installer(src_filepath, dst_filename, progress=None)[source]¶
Upload installer file to server.
- Parameters:
src_filepath (
str
) – Source filepath.dst_filename (
str
) – Destination filename.progress (
Optional[TransferProgress]
) – Object that gives ability to track download progress.
- Returns:
Response object.
- Return type:
requests.Response
- upload_reviewable(project_name, version_id, filepath, label=None, content_type=None, filename=None, progress=None, headers=None, **kwargs)[source]¶
Upload reviewable file to server.
- Parameters:
project_name (
str
) – Project name.version_id (
str
) – Version id.filepath (
str
) – Reviewable file path to upload.label (
Optional[str]
) – Reviewable label. Filled automatically server side with filename.content_type (
Optional[str]
) – MIME type of the file.filename (
Optional[str]
) – User as original filename. Filename from ‘filepath’ is used when not filled.progress (
Optional[TransferProgress]
) – Progress.headers (
Optional[Dict[str, Any]]
) – Headers.
- Returns:
Server response.
- Return type:
- class ServiceContext[source]¶
Bases:
object
Helper for services running under server.
When service is running from server the process receives information about connection from environment variables. This class helps to initialize the values without knowing environment variables (that may change over time).
All what must be done is to call ‘init_service’ function/method. The arguments are for cases when the service is running in specific environment and their values are e.g. loaded from private file or for testing purposes.
- addon_name = None¶
- addon_version = None¶
- classmethod init_service(token=None, server_url=None, addon_name=None, addon_version=None, service_name=None, connect=True)[source]¶
- server_url = None¶
- service_name = None¶
- token = None¶
- class TransferProgress[source]¶
Bases:
object
Object to store progress of download/upload from/to server.
- add_transferred_chunk(chunk_size)[source]¶
Add transferred chunk size in bytes.
- Parameters:
chunk_size (
int
) – Add transferred chunk size in bytes.
- property content_size¶
Content size in bytes.
- Returns:
- Content size in bytes or None
if is unknown.
- Return type:
Union[int, None]
- property destination_url¶
Destination url where transfer happens.
Note
- Consider this as title. Must be set using
‘set_source_url’ or ‘N/A’ will be returned.
- Returns:
Destination url where transfer happens.
- Return type:
str
- property fail_reason¶
Get reason why transfer failed.
- Returns:
- Reason why transfer
failed or None.
- Return type:
Union[str, None]
- property failed¶
Transfer failed.
- Returns:
True if transfer failed.
- Return type:
bool
- get_content_size()[source]¶
Content size in bytes.
- Returns:
- Content size in bytes or None
if is unknown.
- Return type:
Union[int, None]
- get_destination_url()[source]¶
Destination url where transfer happens.
Note
- Consider this as title. Must be set using
‘set_source_url’ or ‘N/A’ will be returned.
- Returns:
Destination url where transfer happens.
- Return type:
str
- get_fail_reason()[source]¶
Get reason why transfer failed.
- Returns:
- Reason why transfer
failed or None.
- Return type:
Union[str, None]
- get_source_url()[source]¶
Source url from where transfer happens.
Note
- Consider this as title. Must be set using
‘set_source_url’ or ‘N/A’ will be returned.
- Returns:
Source url from where transfer happens.
- Return type:
str
- get_transferred_size()[source]¶
Already transferred size in bytes.
- Returns:
Already transferred size in bytes.
- Return type:
int
- property is_running¶
Check if transfer is running.
- Returns:
True if transfer is running.
- Return type:
bool
- set_content_size(content_size)[source]¶
Set content size in bytes.
- Parameters:
content_size (
int
) – Content size in bytes.- Raises:
ValueError – If content size was already set.
- set_destination_url(url)[source]¶
Set destination url where transfer happens.
- Parameters:
url (
str
) – Destination url where transfer happens.
- set_failed(reason)[source]¶
Mark progress as failed.
- Parameters:
reason (
str
) – Reason why transfer failed.
- set_source_url(url)[source]¶
Set source url from where transfer happens.
- Parameters:
url (
str
) – Source url from where transfer happens.
- set_started()[source]¶
Mark that transfer started.
- Raises:
ValueError – If transfer was already started.
- set_transfer_done()[source]¶
Mark progress as transfer finished.
- Raises:
ValueError – If progress was already marked as done or wasn’t started yet.
- set_transferred_size(transferred)[source]¶
Set already transferred size in bytes.
- Parameters:
transferred (
int
) – Already transferred size in bytes.
- property source_url¶
Source url from where transfer happens.
Note
- Consider this as title. Must be set using
‘set_source_url’ or ‘N/A’ will be returned.
- Returns:
Source url from where transfer happens.
- Return type:
str
- property started¶
Transfer was started.
- Returns:
True if transfer started.
- Return type:
bool
- property transfer_done¶
Transfer finished.
- Returns:
Transfer finished.
- Return type:
bool
- property transfer_progress¶
Get transfer progress in percents.
- Returns:
- Transfer progress in percents or ‘None’
if content size is unknown.
- Return type:
Union[float, None]
- property transferred_size¶
Already transferred size in bytes.
- Returns:
Already transferred size in bytes.
- Return type:
int
- abort_web_action_event(server_url: str, action_token: str, reason: str)[source]¶
Abort web action event using action token.
A web action event could not be processed for some reason.
- Parameters:
server_url (
str
) – AYON server url.action_token (
str
) – Action token.reason (
str
) – Reason why webaction event was aborted.
- Returns:
Response from server.
- Return type:
requests.Response
- change_token(url, token)[source]¶
Change connection token for url.
This function can be also used to change url.
- Parameters:
url (
str
) – Server url.token (
str
) – API key token.
- check_bundle_compatibility(*args, **kwargs)[source]¶
Check bundle compatibility.
Can be used as per-flight validation before creating bundle.
- Parameters:
name (
str
) – Name of bundle.addon_versions (
dict[str, str]
) – Addon versions.installer_version (
Union[str, None]
) – Installer version.dependency_packages (
Optional[dict[str, str]]
) – Dependency package names. Keys are platform names and values are name of packages.is_production (
Optional[bool]
) – Bundle will be marked as production.is_staging (
Optional[bool]
) – Bundle will be marked as staging.is_dev (
Optional[bool]
) – Bundle will be marked as dev.dev_active_user (
Optional[str]
) – Username that will be assigned to dev bundle. Can be used only if ‘is_dev’ is set to ‘True’.dev_addons_config (
Optional[dict[str, Any]]
) – Configuration for dev addons. Can be used only if ‘is_dev’ is set to ‘True’.
- Returns:
Server response, with ‘success’ and ‘issues’.
- Return type:
Dict[str, Any]
- create_bundle(*args, **kwargs)[source]¶
Create bundle on server.
Bundle cannot be changed once is created. Only isProduction, isStaging and dependency packages can change after creation. In case dev bundle is created, it is possible to change anything, but it is not possible to mark bundle as dev and production or staging at the same time.
Development addon config can define custom path to client code. It is used only for dev bundles.
Example of ‘dev_addons_config’:
```json { "core": { "enabled": true, "path": "/path/to/ayon-core/client" } } ```
- Parameters:
name (
str
) – Name of bundle.addon_versions (
dict[str, str]
) – Addon versions.installer_version (
Union[str, None]
) – Installer version.dependency_packages (
Optional[dict[str, str]]
) – Dependency package names. Keys are platform names and values are name of packages.is_production (
Optional[bool]
) – Bundle will be marked as production.is_staging (
Optional[bool]
) – Bundle will be marked as staging.is_dev (
Optional[bool]
) – Bundle will be marked as dev.dev_active_user (
Optional[str]
) – Username that will be assigned to dev bundle. Can be used only if ‘is_dev’ is set to ‘True’.dev_addons_config (
Optional[dict[str, Any]]
) – Configuration for dev addons. Can be used only if ‘is_dev’ is set to ‘True’.
- create_connection(site_id=None, client_version=None)[source]¶
Create global connection.
- Parameters:
site_id (
str
) – Machine site id/name.client_version (
str
) – Desktop app version.
- Returns:
Created connection.
- Return type:
- create_dependency_package(*args, **kwargs)[source]¶
Create dependency package on server.
The package will be created on a server, it is also required to upload the package archive file (using
upload_dependency_package()
).- Parameters:
filename (
str
) – Filename of dependency package.python_modules (
dict[str, str]
) –Python modules in dependency package:
{"<module name>": "<module version>", ...}
source_addons (
dict[str, str]
) –Name of addons for which is dependency package created:
{"<addon name>": "<addon version>", ...}
installer_version (
str
) – Version of installer for which was package created.checksum (
str
) – Checksum of archive file where dependencies are.checksum_algorithm (
str
) – Algorithm used to calculate checksum.file_size (
Optional[int]
) – Size of file.sources (
Optional[list[dict[str, Any]]]
) – Information about sources from where it is possible to get file.platform_name (
Optional[str]
) – Name of platform for which is dependency package targeted. Default value is current platform.
- create_dependency_package_basename(platform_name=None)[source]¶
Create basename for dependency package file.
- Parameters:
platform_name (
Optional[str]
) – Name of platform for which the bundle is targeted. Default value is current platform.- Returns:
Dependency package name with timestamp and platform.
- Return type:
str
- create_folder(*args, **kwargs)[source]¶
Create new folder.
- Parameters:
project_name (
str
) – Project name.name (
str
) – Folder name.folder_type (
Optional[str]
) – Folder type.parent_id (
Optional[str]
) – Parent folder id. Parent is project if isNone
.label (
Optional[str]
) – Label of folder.attrib (
Optional[dict[str, Any]]
) – Folder attributes.data (
Optional[dict[str, Any]]
) – Folder data.tags (
Optional[Iterable[str]]
) – Folder tags.status (
Optional[str]
) – Folder status.active (
Optional[bool]
) – Folder active state.thumbnail_id (
Optional[str]
) – Folder thumbnail id.folder_id (
Optional[str]
) – Folder id. If not passed new id is generated.
- Returns:
Entity id.
- Return type:
str
- create_installer(*args, **kwargs)[source]¶
Create new installer information on server.
- This step will create only metadata. Make sure to upload installer
to the server using ‘upload_installer’ method.
- Runtime python modules are modules that are required to run AYON
desktop application, but are not added to PYTHONPATH for any subprocess.
- Parameters:
filename (
str
) – Installer filename.version (
str
) – Version of installer.python_version (
str
) – Version of Python.platform_name (
str
) – Name of platform.python_modules (
dict[str, str]
) – Python modules that are available in installer.runtime_python_modules (
dict[str, str]
) – Runtime python modules that are available in installer.checksum (
str
) – Installer file checksum.checksum_algorithm (
str
) – Type of checksum used to create checksum.file_size (
int
) – File size.sources (
Optional[list[dict[str, Any]]]
) – List of sources that can be used to download file.
- create_link(*args, **kwargs)[source]¶
Create link between 2 entities.
Link has a type which must already exists on a project.
Example output:
{ "id": "59a212c0d2e211eda0e20242ac120002" }
- Parameters:
project_name (
str
) – Project where the link is created.link_type_name (
str
) – Type of link.input_id (
str
) – Input entity id.input_type (
str
) – Entity type of input entity.output_id (
str
) – Output entity id.output_type (
str
) – Entity type of output entity.link_name (
Optional[str]
) – Name of link. Available from server version ‘1.0.0-rc.6’.
- Returns:
Information about link.
- Return type:
dict[str, str]
- Raises:
HTTPRequestError – Server error happened.
- create_link_type(*args, **kwargs)[source]¶
Create or update link type on server.
Warning
Because PUT is used for creation it is also used for update.
- Parameters:
project_name (
str
) – Project where link type is created.link_type_name (
str
) – Name of link type.input_type (
str
) – Input entity type of link.output_type (
str
) – Output entity type of link.data (
Optional[dict[str, Any]]
) – Additional data related to link.
- Raises:
HTTPRequestError – Server error happened.
- create_product(*args, **kwargs)[source]¶
Create new product.
- Parameters:
project_name (
str
) – Project name.name (
str
) – Product name.product_type (
str
) – Product type.folder_id (
str
) – Parent folder id.attrib (
Optional[dict[str, Any]]
) – Product attributes.data (
Optional[dict[str, Any]]
) – Product data.tags (
Optional[Iterable[str]]
) – Product tags.status (
Optional[str]
) – Product status.active (
Optional[bool]
) – Product active state.product_id (
Optional[str]
) – Product id. If not passed new id is generated.
- Returns:
Product id.
- Return type:
str
- create_project(*args, **kwargs)[source]¶
Create project using AYON settings.
This project creation function is not validating project entity on creation. It is because project entity is created blindly with only minimum required information about project which is name and code.
Entered project name must be unique and project must not exist yet.
Note
- This function is here to be OP v4 ready but in v3 has more logic
to do. That’s why inner imports are in the body.
- Parameters:
project_name (
str
) – New project name. Should be unique.project_code (
str
) – Project’s code should be unique too.library_project (
Optional[bool]
) – Project is library project.preset_name (
Optional[str]
) – Name of anatomy preset. Default is used if not passed.
- Raises:
ValueError – When project name already exists.
- Returns:
Created project entity.
- Return type:
dict[str, Any]
- create_representation(*args, **kwargs)[source]¶
Create new representation.
- Parameters:
project_name (
str
) – Project name.name (
str
) – Representation name.version_id (
str
) – Parent version id.files (
Optional[list[dict]]
) – Representation files information.attrib (
Optional[dict[str, Any]]
) – Representation attributes.data (
Optional[dict[str, Any]]
) – Representation data.tags (
Optional[Iterable[str]]
) – Representation tags.status (
Optional[str]
) – Representation status.active (
Optional[bool]
) – Representation active state.representation_id (
Optional[str]
) – Representation id. If not passed new id is generated.
- Returns:
Representation id.
- Return type:
str
- create_task(*args, **kwargs)[source]¶
Create new task.
- Parameters:
project_name (
str
) – Project name.name (
str
) – Folder name.task_type (
str
) – Task type.folder_id (
str
) – Parent folder id.label (
Optional[str]
) – Label of folder.assignees (
Optional[Iterable[str]]
) – Task assignees.attrib (
Optional[dict[str, Any]]
) – Task attributes.data (
Optional[dict[str, Any]]
) – Task data.tags (
Optional[Iterable[str]]
) – Task tags.status (
Optional[str]
) – Task status.active (
Optional[bool]
) – Task active state.thumbnail_id (
Optional[str]
) – Task thumbnail id.task_id (
Optional[str]
) – Task id. If not passed new id is generated.
- Returns:
Task id.
- Return type:
str
- create_thumbnail(*args, **kwargs)[source]¶
Create new thumbnail on server from passed path.
- Parameters:
project_name (
str
) – Project where the thumbnail will be created and can be used.src_filepath (
str
) – Filepath to thumbnail which should be uploaded.thumbnail_id (
Optional[str]
) – Prepared if of thumbnail.
- Returns:
Created thumbnail id.
- Return type:
str
- Raises:
ValueError – When thumbnail source cannot be processed.
- create_version(*args, **kwargs)[source]¶
Create new version.
- Parameters:
project_name (
str
) – Project name.version (
int
) – Version.product_id (
str
) – Parent product id.task_id (
Optional[str]
) – Parent task id.author (
Optional[str]
) – Version author.attrib (
Optional[dict[str, Any]]
) – Version attributes.data (
Optional[dict[str, Any]]
) – Version data.tags (
Optional[Iterable[str]]
) – Version tags.status (
Optional[str]
) – Version status.active (
Optional[bool]
) – Version active state.thumbnail_id (
Optional[str]
) – Version thumbnail id.version_id (
Optional[str]
) – Version id. If not passed new id is generated.
- Returns:
Version id.
- Return type:
str
- delete_bundle(*args, **kwargs)[source]¶
Delete bundle from server.
- Parameters:
bundle_name (
str
) – Name of bundle to delete.
- delete_dependency_package(*args, **kwargs)[source]¶
Remove dependency package for specific platform.
- Parameters:
filename (
str
) – Filename of dependency package.platform_name (
Optional[str]
) – Deprecated.
- delete_folder(*args, **kwargs)[source]¶
Delete folder.
- Parameters:
project_name (
str
) – Project name.folder_id (
str
) – Folder id to delete.force (
Optional[bool]
) – Folder delete folder with all children folder, products, versions and representations.
- delete_installer(*args, **kwargs)[source]¶
Delete installer from server.
- Parameters:
filename (
str
) – Installer filename.
- delete_link(*args, **kwargs)[source]¶
Remove link by id.
- Parameters:
project_name (
str
) – Project where link exists.link_id (
str
) – Id of link.
- Raises:
HTTPRequestError – Server error happened.
- delete_link_type(*args, **kwargs)[source]¶
Remove link type from project.
- Parameters:
project_name (
str
) – Project where link type is created.link_type_name (
str
) – Name of link type.input_type (
str
) – Input entity type of link.output_type (
str
) – Output entity type of link.
- Raises:
HTTPRequestError – Server error happened.
- delete_product(*args, **kwargs)[source]¶
Delete product.
- Parameters:
project_name (
str
) – Project name.product_id (
str
) – Product id to delete.
- delete_project(*args, **kwargs)[source]¶
Delete project from server.
This will completely remove project from server without any step back.
- Parameters:
project_name (
str
) – Project name that will be removed.
- delete_representation(*args, **kwargs)[source]¶
Delete representation.
- Parameters:
project_name (
str
) – Project name.representation_id (
str
) – Representation id to delete.
- delete_secret(*args, **kwargs)[source]¶
Delete secret by name.
- Parameters:
secret_name (
str
) – Name of secret to delete.
- delete_task(*args, **kwargs)[source]¶
Delete task.
- Parameters:
project_name (
str
) – Project name.task_id (
str
) – Task id to delete.
- delete_version(*args, **kwargs)[source]¶
Delete version.
- Parameters:
project_name (
str
) – Project name.version_id (
str
) – Version id to delete.
- dispatch_event(*args, **kwargs)[source]¶
Dispatch event to server.
- Parameters:
topic (
str
) – Event topic used for filtering of listeners.sender (
Optional[str]
) – Sender of event.event_hash (
Optional[str]
) – Event hash.project_name (
Optional[str]
) – Project name.depends_on (
Optional[str]
) – Add dependency to another event.username (
Optional[str]
) – Username which triggered event.description (
Optional[str]
) – Description of event.summary (
Optional[dict[str, Any]]
) – Summary of event that can be used for simple filtering on listeners.payload (
Optional[dict[str, Any]]
) – Full payload of event data with all details.finished (
Optional[bool]
) – Mark event as finished on dispatch.store (
Optional[bool]
) – Store event in event queue for possible future processing otherwise is event send only to active listeners.dependencies (
Optional[list[str]]
) – Deprecated. List of event id dependencies.
- Returns:
Response from server.
- Return type:
- download_addon_private_file(*args, **kwargs)[source]¶
Download a file from addon private files.
This method requires to have authorized token available. Private files are not under ‘/api’ restpoint.
- Parameters:
addon_name (
str
) – Addon name.addon_version (
str
) – Addon version.filename (
str
) – Filename in private folder on server.destination_dir (
str
) – Where the file should be downloaded.destination_filename (
Optional[str]
) – Name of destination filename. Source filename is used if not passed.chunk_size (
Optional[int]
) – Download chunk size.progress (
Optional[TransferProgress]
) – Object that gives ability to track download progress.
- Returns:
Filepath to downloaded file.
- Return type:
str
- download_dependency_package(*args, **kwargs)[source]¶
Download dependency package from server.
This method requires to have authorized token available. The package is only downloaded.
- Parameters:
src_filename (
str
) – Filename of dependency pacakge. For server version 0.2.0 and lower it is name of package to download.dst_directory (
str
) – Where the file should be downloaded.dst_filename (
str
) – Name of destination filename.platform_name (
Optional[str]
) – Deprecated.chunk_size (
Optional[int]
) – Download chunk size.progress (
Optional[TransferProgress]
) – Object that gives ability to track download progress.
- Returns:
Filepath to downloaded file.
- Return type:
str
- download_file(*args, **kwargs)[source]¶
Download file from AYON server.
Endpoint can be full url (must start with ‘base_url’ of api object).
Progress object can be used to track download. Can be used when download happens in thread and other thread want to catch changes over time.
- Todos:
Use retries and timeout. Return RestApiResponse.
- Parameters:
endpoint (
str
) – Endpoint or URL to file that should be downloaded.filepath (
str
) – Path where file will be downloaded.chunk_size (
Optional[int]
) – Size of chunks that are received in single loop.progress (
Optional[TransferProgress]
) – Object that gives ability to track download progress.
- download_file_to_stream(*args, **kwargs)[source]¶
Download file from AYON server to IOStream.
Endpoint can be full url (must start with ‘base_url’ of api object).
Progress object can be used to track download. Can be used when download happens in thread and other thread want to catch changes over time.
- Todos:
Use retries and timeout. Return RestApiResponse.
- Parameters:
endpoint (
str
) – Endpoint or URL to file that should be downloaded.stream (
Union[io.BytesIO, BinaryIO]
) – Stream where output will be stored.chunk_size (
Optional[int]
) – Size of chunks that are received in single loop.progress (
Optional[TransferProgress]
) – Object that gives ability to track download progress.
- download_installer(*args, **kwargs)[source]¶
Download installer file from server.
- Parameters:
filename (
str
) – Installer filename.dst_filepath (
str
) – Destination filepath.chunk_size (
Optional[int]
) – Download chunk size.progress (
Optional[TransferProgress]
) – Object that gives ability to track download progress.
- enroll_event_job(*args, **kwargs)[source]¶
Enroll job based on events.
Enroll will find first unprocessed event with ‘source_topic’ and will create new event with ‘target_topic’ for it and return the new event data.
Use ‘sequential’ to control that only single target event is created at same time. Creation of new target events is blocked while there is at least one unfinished event with target topic, when set to ‘True’. This helps when order of events matter and more than one process using the same target is running at the same time.
Make sure the new event has updated status to ‘“finished”’ status when you’re done with logic
Target topic should not clash with other processes/services.
Created target event have ‘dependsOn’ key where is id of source topic.
- Use-case:
Service 1 is creating events with topic ‘my.leech’
- Service 2 process ‘my.leech’ and uses target topic ‘my.process’
this service can run on 1-n machines
- all events must be processed in a sequence by their creation
time and only one event can be processed at a time
- in this case ‘sequential’ should be set to ‘True’ so only
one machine is actually processing events, but if one goes down there are other that can take place
- Service 3 process ‘my.leech’ and uses target topic ‘my.discover’
this service can run on 1-n machines
order of events is not important
‘sequential’ should be ‘False’
- Parameters:
source_topic (
str
) – Source topic to enroll.target_topic (
str
) – Topic of dependent event.sender (
str
) – Identifier of sender (e.g. service name or username).description (
Optional[str]
) – Human readable text shown in target event.sequential (
Optional[bool]
) – The source topic must be processed in sequence.events_filter (
Optional[dict[str, Any]]
) – Filtering conditions to filter the source event. For more technical specifications look to server backed ‘ayon_server.sqlfilter.Filter’. TODO: Add example of filters.max_retries (
Optional[int]
) – How many times can be event retried. Default value is based on server (3 at the time of this PR).
- Returns:
- None if there is no event matching
filters. Created event with ‘target_topic’.
- Return type:
Union[None, dict[str, Any]]
- get_addon_endpoint(*args, **kwargs)[source]¶
Calculate endpoint to addon route.
Examples
>>> api = ServerAPI("https://your.url.com") >>> api.get_addon_url( ... "example", "1.0.0", "private", "my.zip") 'addons/example/1.0.0/private/my.zip'
- Parameters:
addon_name (
str
) – Name of addon.addon_version (
str
) – Version of addon.*subpaths (
str
) – Any amount of subpaths that are added to addon url.
- Returns:
Final url.
- Return type:
str
- get_addon_project_settings(*args, **kwargs)[source]¶
Addon project settings.
Receive project settings for specific version of an addon. The settings may be with site overrides when enabled.
Site id is filled with current connection site id if not passed. To make sure any site id is used set ‘use_site’ to ‘False’.
- Parameters:
addon_name (
str
) – Name of addon.addon_version (
str
) – Version of addon.project_name (
str
) – Name of project for which the settings are received.variant (
Optional[Literal['production', 'staging']]
) – Name of settings variant. Used ‘default_settings_variant’ by default.site_id (
Optional[str]
) – Name of site which is used for site overrides. Is filled with connection ‘site_id’ attribute if not passed.use_site (
Optional[bool]
) – To force disable option of using site overrides set to ‘False’. In that case won’t be applied any site overrides.
- Returns:
Addon settings.
- Return type:
dict[str, Any]
- get_addon_settings(*args, **kwargs)[source]¶
Receive addon settings.
Receive addon settings based on project name value. Some arguments may be ignored if ‘project_name’ is set to ‘None’.
- Parameters:
addon_name (
str
) – Name of addon.addon_version (
str
) – Version of addon.project_name (
Optional[str]
) – Name of project for which the settings are received. A studio settings values are received if is ‘None’.variant (
Optional[Literal['production', 'staging']]
) – Name of settings variant. Used ‘default_settings_variant’ by default.site_id (
Optional[str]
) – Name of site which is used for site overrides. Is filled with connection ‘site_id’ attribute if not passed.use_site (
Optional[bool]
) – To force disable option of using site overrides set to ‘False’. In that case won’t be applied any site overrides.
- Returns:
Addon settings.
- Return type:
dict[str, Any]
- get_addon_settings_schema(*args, **kwargs)[source]¶
Sudio/Project settings schema of an addon.
Project schema may look differently as some enums are based on project values.
- Parameters:
addon_name (
str
) – Name of addon.addon_version (
str
) – Version of addon.project_name (
Optional[str]
) – Schema for specific project or default studio schemas.
- Returns:
Schema of studio/project settings.
- Return type:
dict[str, Any]
- get_addon_site_settings(*args, **kwargs)[source]¶
Site settings of an addon.
If site id is not available an empty dictionary is returned.
- Parameters:
addon_name (
str
) – Name of addon.addon_version (
str
) – Version of addon.site_id (
Optional[str]
) – Name of site for which should be settings returned. using ‘site_id’ attribute if not passed.
- Returns:
Site settings.
- Return type:
dict[str, Any]
- get_addon_site_settings_schema(*args, **kwargs)[source]¶
Site settings schema of an addon.
- Parameters:
addon_name (
str
) – Name of addon.addon_version (
str
) – Version of addon.
- Returns:
Schema of site settings.
- Return type:
dict[str, Any]
- get_addon_studio_settings(*args, **kwargs)[source]¶
Addon studio settings.
Receive studio settings for specific version of an addon.
- Parameters:
addon_name (
str
) – Name of addon.addon_version (
str
) – Version of addon.variant (
Optional[Literal['production', 'staging']]
) – Name of settings variant. Used ‘default_settings_variant’ by default.
- Returns:
Addon settings.
- Return type:
dict[str, Any]
- get_addon_url(*args, **kwargs)[source]¶
Calculate url to addon route.
Examples
>>> api = ServerAPI("https://your.url.com") >>> api.get_addon_url( ... "example", "1.0.0", "private", "my.zip") 'https://your.url.com/api/addons/example/1.0.0/private/my.zip'
- Parameters:
addon_name (
str
) – Name of addon.addon_version (
str
) – Version of addon.*subpaths (
str
) – Any amount of subpaths that are added to addon url.use_rest (
Optional[bool]
) – Use rest endpoint.
- Returns:
Final url.
- Return type:
str
- get_addons_info(*args, **kwargs)[source]¶
Get information about addons available on server.
- Parameters:
details (
Optional[bool]
) – Detailed data with information how to get client code.
- get_addons_project_settings(*args, **kwargs)[source]¶
Project settings of all addons.
Server returns information about used addon versions, so full output looks like:
The output can be limited to only values. To do so is ‘only_values’ argument which is by default set to ‘True’. In that case output contains only value of ‘settings’ key.
Warning
- Behavior of this function changed with AYON server version 0.3.0.
Structure of output from server changed. If using ‘only_values=True’ then output should be same as before.
- Parameters:
project_name (
str
) – Name of project for which are settings received.bundle_name (
Optional[str]
) – Name of bundle for which should be settings received.variant (
Optional[Literal['production', 'staging']]
) – Name of settings variant. Used ‘default_settings_variant’ by default.site_id (
Optional[str]
) – Site id for which want to receive site overrides.use_site (
bool
) – To force disable option of using site overrides set to ‘False’. In that case won’t be applied any site overrides.only_values (
Optional[bool]
) – Output will contain only settings values without metadata about addons.
- Returns:
- Settings of all addons on server for passed
project.
- Return type:
dict[str, Any]
- get_addons_settings(*args, **kwargs)[source]¶
Universal function to receive all addon settings.
Based on ‘project_name’ will receive studio settings or project settings. In case project is not passed is ‘site_id’ ignored.
Warning
- Behavior of this function changed with AYON server version 0.3.0.
Structure of output from server changed. If using ‘only_values=True’ then output should be same as before.
- Parameters:
bundle_name (
Optional[str]
) – Name of bundle for which should be settings received.project_name (
Optional[str]
) – Name of project for which should be settings received.variant (
Optional[Literal['production', 'staging']]
) – Name of settings variant. Used ‘default_settings_variant’ by default.site_id (
Optional[str]
) – Id of site for which want to receive site overrides.use_site (
Optional[bool]
) – To force disable option of using site overrides set to ‘False’. In that case won’t be applied any site overrides.only_values (
Optional[bool]
) – Only settings values will be returned. By default, is set to ‘True’.
- get_addons_studio_settings(*args, **kwargs)[source]¶
All addons settings in one bulk.
Warning
- Behavior of this function changed with AYON server version 0.3.0.
Structure of output from server changed. If using ‘only_values=True’ then output should be same as before.
- Parameters:
bundle_name (
Optional[str]
) – Name of bundle for which should be settings received.variant (
Optional[Literal['production', 'staging']]
) – Name of settings variant. Used ‘default_settings_variant’ by default.site_id (
Optional[str]
) – Site id for which want to receive site overrides.use_site (
bool
) – To force disable option of using site overrides set to ‘False’. In that case won’t be applied any site overrides.only_values (
Optional[bool]
) – Output will contain only settings values without metadata about addons.
- Returns:
Settings of all addons on server.
- Return type:
dict[str, Any]
- get_attributes_fields_for_type(*args, **kwargs)[source]¶
Prepare attribute fields for entity type.
- Returns:
Attributes fields for entity type.
- Return type:
set[str]
- get_attributes_for_type(*args, **kwargs)[source]¶
Get attribute schemas available for an entity type.
Example:
``` # Example attribute schema { # Common "type": "integer", "title": "Clip Out", "description": null, "example": 1, "default": 1, # These can be filled based on value of 'type' "gt": null, "ge": null, "lt": null, "le": null, "minLength": null, "maxLength": null, "minItems": null, "maxItems": null, "regex": null, "enum": null } ```
- Parameters:
entity_type (
str
) – Entity type for which should be attributes received.- Returns:
- Attribute schemas that are available
for entered entity type.
- Return type:
dict[str, dict[str, Any]]
- get_build_in_anatomy_preset()[source]¶
Get built-in anatomy preset.
- Returns:
Built-in anatomy preset.
- Return type:
dict[str, Any]
- get_bundle_settings(*args, **kwargs)[source]¶
Get complete set of settings for given data.
If project is not passed then studio settings are returned. If variant is not passed ‘default_settings_variant’ is used. If bundle name is not passed then current production/staging bundle is used, based on variant value.
Output contains addon settings and site settings in single dictionary.
- Todos:
test how it behaves if there is not any bundle.
- test how it behaves if there is not any production/staging
bundle.
Example output:
{ "addons": [ { "name": "addon-name", "version": "addon-version", "settings": {...}, "siteSettings": {...} } ] }
- Returns:
All settings for single bundle.
- Return type:
dict[str, Any]
- get_bundles()[source]¶
Server bundles with basic information.
This is example output:
{ "bundles": [ { "name": "my_bundle", "createdAt": "2023-06-12T15:37:02.420260", "installerVersion": "1.0.0", "addons": { "core": "1.2.3" }, "dependencyPackages": { "windows": "a_windows_package123.zip", "linux": "a_linux_package123.zip", "darwin": "a_mac_package123.zip" }, "isProduction": False, "isStaging": False } ], "productionBundle": "my_bundle", "stagingBundle": "test_bundle" }
- Returns:
Server bundles with basic information.
- Return type:
dict[str, Any]
- get_cert()[source]¶
Current cert file used for connection to server.
- Returns:
Path to cert file.
- Return type:
Union[str, None]
- get_client_version()[source]¶
Version of client used to connect to server.
Client version is AYON client build desktop application.
- Returns:
Client version string used in connection.
- Return type:
str
- get_default_anatomy_preset_name()[source]¶
Name of default anatomy preset.
Primary preset is used as default preset. But when primary preset is not set a built-in is used instead. Built-in preset is named ‘_’.
- Returns:
- Name of preset that can be used by
’get_project_anatomy_preset’.
- Return type:
str
- get_default_fields_for_type(*args, **kwargs)[source]¶
Default fields for entity type.
Returns most of commonly used fields from server.
- Parameters:
entity_type (
str
) – Name of entity type.- Returns:
Fields that should be queried from server.
- Return type:
set[str]
- get_default_settings_variant()[source]¶
Default variant used for settings.
- Returns:
name of variant or None.
- Return type:
Union[str, None]
- get_dependency_packages()[source]¶
Information about dependency packages on server.
To download dependency package, use ‘download_dependency_package’ method and pass in ‘filename’.
Example data structure:
{ "packages": [ { "filename": str, "platform": str, "checksum": str, "checksumAlgorithm": str, "size": int, "sources": list[dict[str, Any]], "supportedAddons": dict[str, str], "pythonModules": dict[str, str] } ] }
- Returns:
- Information about dependency packages known for
server.
- Return type:
dict[str, Any]
- get_entities_links(*args, **kwargs)[source]¶
Helper method to get links from server for entity types.
Example output: { "59a212c0d2e211eda0e20242ac120001": [ { "id": "59a212c0d2e211eda0e20242ac120002", "linkType": "reference", "description": "reference link between folders", "projectName": "my_project", "author": "frantadmin", "entityId": "b1df109676db11ed8e8c6c9466b19aa8", "entityType": "folder", "direction": "out" }, ... ], ... }
- Parameters:
project_name (
str
) – Project where links are.(Literal["folder" (entity_type) –
"task" –
"product" –
:param : :param | “version”: Entity type. :param “representations”]): Entity type. :param entity_ids: Ids of entities for which :type entity_ids:
Optional[Iterable[str]]
:param | links should be received.: :param link_types: Link type filters. :type link_types:Optional[Iterable[str]]
:param link_direction: Link direction :type link_direction:Optional[Literal["in", "out"]]
:param | filter.: :param link_names: Link name filters. :type link_names:Optional[Iterable[str]]
:param link_name_regex: Regex filter for link name. :type link_name_regex:Optional[str]
- Returns:
Link info by entity ids.
- Return type:
dict[str, list[dict[str, Any]]]
- get_event(*args, **kwargs)[source]¶
Query full event data by id.
Events received using event server do not contain full information. To get the full event information is required to receive it explicitly.
- Parameters:
event_id (
str
) – Event id.- Returns:
Full event data.
- Return type:
dict[str, Any]
- get_events(*args, **kwargs)[source]¶
Get events from server with filtering options.
Notes
Not all event happen on a project.
- Parameters:
topics (
Optional[Iterable[str]]
) – Name of topics.event_ids (
Optional[Iterable[str]]
) – Event ids.project_names (
Optional[Iterable[str]]
) – Project on which event happened.states (
Optional[Iterable[str]]
) – Filtering by states.users (
Optional[Iterable[str]]
) – Filtering by users who created/triggered an event.include_logs (
Optional[bool]
) – Query also log events.has_children (
Optional[bool]
) – Event is with/without children events. If ‘None’ then all events are returned, default.newer_than (
Optional[str]
) – Return only events newer than given iso datetime string.older_than (
Optional[str]
) – Return only events older than given iso datetime string.fields (
Optional[Iterable[str]]
) – Fields that should be received for each event.
- Returns:
Available events matching filters.
- Return type:
Generator[dict[str, Any]]
- get_folder_by_id(*args, **kwargs)[source]¶
Query folder entity by id.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.folder_id (
str
) – Folder id.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
Folder entity data or None if was not found.
- Return type:
Union[dict, None]
- get_folder_by_name(*args, **kwargs)[source]¶
Query folder entity by path.
Warning
- Folder name is not a unique identifier of a folder. Function is
kept for OpenPype 3 compatibility.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.folder_name (
str
) – Folder name.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
Folder entity data or None if was not found.
- Return type:
Union[dict, None]
- get_folder_by_path(*args, **kwargs)[source]¶
Query folder entity by path.
Folder path is a path to folder with all parent names joined by slash.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.folder_path (
str
) – Folder path.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
Folder entity data or None if was not found.
- Return type:
Union[dict, None]
- get_folder_ids_with_products(*args, **kwargs)[source]¶
Find folders which have at least one product.
Folders that have at least one product should be immutable, so they should not change path -> change of name or name of any parent is not possible.
- Parameters:
project_name (
str
) – Name of project.folder_ids (
Optional[Iterable[str]]
) – Limit folder ids filtering to a set of folders. If set to None all folders on project are checked.
- Returns:
Folder ids that have at least one product.
- Return type:
set[str]
- get_folder_links(*args, **kwargs)[source]¶
Query folder links from server.
- Parameters:
project_name (
str
) – Project where links are.folder_id (
str
) – Folder id for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info of folder.
- Return type:
list[dict[str, Any]]
- get_folder_thumbnail(*args, **kwargs)[source]¶
Prepared method to receive thumbnail for folder entity.
- Parameters:
project_name (
str
) – Project under which the entity is located.folder_id (
str
) – Folder id for which thumbnail should be returned.thumbnail_id (
Optional[str]
) – Prepared thumbnail id from entity. Used only to check if thumbnail was already cached.
- Returns:
- Path to downloaded thumbnail or none if entity
does not have any (or if user does not have permissions).
- Return type:
Union[str, None]
- get_folders(*args, **kwargs)[source]¶
Query folders from server.
- Todos:
- Folder name won’t be unique identifier, so we should add
folder path filtering.
Notes
Filter ‘active’ don’t have direct filter in GraphQl.
- Parameters:
project_name (
str
) – Name of project.folder_ids (
Optional[Iterable[str]]
) – Folder ids to filter.folder_paths (
Optional[Iterable[str]]
) – Folder paths used for filtering.folder_names (
Optional[Iterable[str]]
) – Folder names used for filtering.folder_types (
Optional[Iterable[str]]
) – Folder types used for filtering.parent_ids (
Optional[Iterable[str]]
) – Ids of folder parents. Use ‘None’ if folder is direct child of project.folder_path_regex (
Optional[str]
) – Folder path regex used for filtering.has_products (
Optional[bool]
) – Filter folders with/without products. Ignored when None, default behavior.has_tasks (
Optional[bool]
) – Filter folders with/without tasks. Ignored when None, default behavior.has_children (
Optional[bool]
) – Filter folders with/without children. Ignored when None, default behavior.statuses (
Optional[Iterable[str]]
) – Folder statuses used for filtering.assignees_all (
Optional[Iterable[str]]
) – Filter by assigness on children tasks. Task must have all of passed assignees.tags (
Optional[Iterable[str]]
) – Folder tags used for filtering.active (
Optional[bool]
) – Filter active/inactive folders. Both are returned if is set to None.has_links (
Optional[Literal[IN, OUT, ANY]]
) – Filter representations with IN/OUT/ANY links.fields (
Optional[Iterable[str]]
) – Fields to be queried for folder. All possible folder fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
Queried folder entities.
- Return type:
Generator[dict[str, Any]]
- get_folders_hierarchy(*args, **kwargs)[source]¶
Get project hierarchy.
All folders in project in hierarchy data structure.
- Example output:
- {
- “hierarchy”: [
- {
“id”: “…”, “name”: “…”, “label”: “…”, “status”: “…”, “folderType”: “…”, “hasTasks”: False, “taskNames”: [], “parents”: [], “parentId”: None, “children”: […children folders…]
]
}
- Parameters:
project_name (
str
) – Project where to look for folders.search_string (
Optional[str]
) – Search string to filter folders.folder_types (
Optional[Iterable[str]]
) – Folder types to filter.
- Returns:
Response data from server.
- Return type:
dict[str, Any]
- get_folders_links(*args, **kwargs)[source]¶
Query folders links from server.
- Parameters:
project_name (
str
) – Project where links are.folder_ids (
Optional[Iterable[str]]
) – Ids of folders for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info by folder ids.
- Return type:
dict[str, list[dict[str, Any]]]
- get_folders_rest(*args, **kwargs)[source]¶
Get simplified flat list of all project folders.
- Get all project folders in single REST call. This can be faster than
using ‘get_folders’ method which is using GraphQl, but does not allow any filtering, and set of fields is defined by server backend.
Example:
[ { "id": "112233445566", "parentId": "112233445567", "path": "/root/parent/child", "parents": ["root", "parent"], "name": "child", "label": "Child", "folderType": "Folder", "hasTasks": False, "hasChildren": False, "taskNames": [ "Compositing", ], "status": "In Progress", "attrib": {}, "ownAttrib": [], "updatedAt": "2023-06-12T15:37:02.420260", }, ... ]
- Deprecated:
- Use ‘get_rest_folders’ instead. Function was renamed to match
other rest functions, like ‘get_rest_folder’, ‘get_rest_project’ etc. .
Will be removed in ‘1.0.7’ or ‘1.1.0’.
- Parameters:
project_name (
str
) – Project name.include_attrib (
Optional[bool]
) – Include attribute values in output. Slower to query.
- Returns:
List of folder entities.
- Return type:
list[dict[str, Any]]
- get_full_link_type_name(*args, **kwargs)[source]¶
Calculate full link type name used for query from server.
- Parameters:
link_type_name (
str
) – Type of link.input_type (
str
) – Input entity type of link.output_type (
str
) – Output entity type of link.
- Returns:
Full name of link type used for query from server.
- Return type:
str
- get_hero_version_by_id(*args, **kwargs)[source]¶
Query hero version entity by id.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.version_id (
int
) – Hero version id.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for versions.
- Returns:
Version entity data or None if was not found.
- Return type:
Union[dict, None]
- get_hero_version_by_product_id(*args, **kwargs)[source]¶
Query hero version entity by product id.
Only one hero version is available on a product.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.product_id (
int
) – Product id.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for versions.
- Returns:
Version entity data or None if was not found.
- Return type:
Union[dict, None]
- get_hero_versions(*args, **kwargs)[source]¶
Query hero versions by multiple filters.
Only one hero version is available on a product.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.product_ids (
Optional[Iterable[str]]
) – Product ids.version_ids (
Optional[Iterable[str]]
) – Version ids.active (
Optional[bool]
) – Receive active/inactive entities. Both are returned when ‘None’ is passed.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for versions.
- Returns:
Version entity data or None if was not found.
- Return type:
Union[dict, None]
- get_info()[source]¶
Get information about current used api key.
By default, the ‘info’ contains only ‘uptime’ and ‘version’. With logged user info also contains information about user and machines on which was logged in.
- Todos:
Use this method for validation of token instead of ‘get_user’.
- Returns:
Information from server.
- Return type:
dict[str, Any]
- get_installers(*args, **kwargs)[source]¶
Information about desktop application installers on server.
Desktop application installers are helpers to download/update AYON desktop application for artists.
- Parameters:
version (
Optional[str]
) – Filter installers by version.platform_name (
Optional[str]
) – Filter installers by platform name.
- Return type:
list[dict[str, Any]]
- get_last_version_by_product_id(*args, **kwargs)[source]¶
Query last version entity by product id.
- Parameters:
project_name (
str
) – Project where to look for representation.product_id (
str
) – Product id.active (
Optional[bool]
) – Receive active/inactive entities. Both are returned when ‘None’ is passed.fields (
Optional[Iterable[str]]
) – fields to be queried for representations.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for versions.
- Returns:
Queried version entity or None.
- Return type:
Union[dict[str, Any], None]
- get_last_version_by_product_name(*args, **kwargs)[source]¶
Query last version entity by product name and folder id.
- Parameters:
project_name (
str
) – Project where to look for representation.product_name (
str
) – Product name.folder_id (
str
) – Folder id.active (
Optional[bool]
) – Receive active/inactive entities. Both are returned when ‘None’ is passed.fields (
Optional[Iterable[str]]
) – fields to be queried for representations.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for representations.
- Returns:
Queried version entity or None.
- Return type:
Union[dict[str, Any], None]
- get_last_versions(*args, **kwargs)[source]¶
Query last version entities by product ids.
- Parameters:
project_name (
str
) – Project where to look for representation.product_ids (
Iterable[str]
) – Product ids.active (
Optional[bool]
) – Receive active/inactive entities. Both are returned when ‘None’ is passed.fields (
Optional[Iterable[str]]
) – fields to be queried for representations.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for versions.
- Returns:
Last versions by product id.
- Return type:
dict[str, dict[str, Any]]
- get_link_type(*args, **kwargs)[source]¶
Get link type data.
There is not dedicated REST endpoint to get single link type, so method ‘get_link_types’ is used.
- Example output:
- {
“name”: “reference|folder|folder”, “link_type”: “reference”, “input_type”: “folder”, “output_type”: “folder”, “data”: {}
}
- Parameters:
project_name (
str
) – Project where link type is available.link_type_name (
str
) – Name of link type.input_type (
str
) – Input entity type of link.output_type (
str
) – Output entity type of link.
- Returns:
Link type information.
- Return type:
Union[None, dict[str, Any]]
- get_link_types(*args, **kwargs)[source]¶
All link types available on a project.
- Example output:
- [
- {
“name”: “reference|folder|folder”, “link_type”: “reference”, “input_type”: “folder”, “output_type”: “folder”, “data”: {}
}
]
- Parameters:
project_name (
str
) – Name of project where to look for link types.- Returns:
Link types available on project.
- Return type:
list[dict[str, Any]]
- get_max_retries()[source]¶
Current value for requests max retries.
- Returns:
Max retries value.
- Return type:
int
- get_product_by_id(*args, **kwargs)[source]¶
Query product entity by id.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.product_id (
str
) – Product id.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for products.
- Returns:
Product entity data or None if was not found.
- Return type:
Union[dict, None]
- get_product_by_name(*args, **kwargs)[source]¶
Query product entity by name and folder id.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.product_name (
str
) – Product name.folder_id (
str
) – Folder id (Folder is a parent of products).fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for products.
- Returns:
Product entity data or None if was not found.
- Return type:
Union[dict, None]
- get_product_links(*args, **kwargs)[source]¶
Query product links from server.
- Parameters:
project_name (
str
) – Project where links are.product_id (
str
) – Product id for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info of product.
- Return type:
list[dict[str, Any]]
- get_product_type_names(*args, **kwargs)[source]¶
Product type names.
Warning
- This function will be probably removed. Matters if ‘products_id’
filter has real use-case.
- Parameters:
project_name (
Optional[str]
) – Name of project where to look for queried entities.product_ids (
Optional[Iterable[str]]
) – Product ids filter. Can be used only with ‘project_name’.
- Returns:
Product type names.
- Return type:
set[str]
- get_product_types(*args, **kwargs)[source]¶
Types of products.
- This is server wide information. Product types have ‘name’, ‘icon’ and
‘color’.
- Parameters:
fields (
Optional[Iterable[str]]
) – Product types fields to query.- Returns:
Product types information.
- Return type:
list[dict[str, Any]]
- get_products(*args, **kwargs)[source]¶
Query products from server.
- Todos:
- Separate ‘name_by_folder_ids’ filtering to separated method. It
cannot be combined with some other filters.
- Parameters:
project_name (
str
) – Name of project.product_ids (
Optional[Iterable[str]]
) – Task ids to filter.product_names (
Optional[Iterable[str]]
) – Task names used for filtering.folder_ids (
Optional[Iterable[str]]
) – Ids of task parents. Use ‘None’ if folder is direct child of project.product_types (
Optional[Iterable[str]]
) – Product types used for filtering.product_name_regex (
Optional[str]
) – Filter products by name regex.product_path_regex (
Optional[str]
) – Filter products by path regex. Path starts with folder path and ends with product name.names_by_folder_ids (
Optional[dict[str, Iterable[str]]]
) – Product name filtering by folder id.statuses (
Optional[Iterable[str]]
) – Product statuses used for filtering.tags (
Optional[Iterable[str]]
) – Product tags used for filtering.active (
Optional[bool]
) – Filter active/inactive products. Both are returned if is set to None.fields (
Optional[Iterable[str]]
) – Fields to be queried for folder. All possible folder fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for products.
- Returns:
Queried product entities.
- Return type:
Generator[dict[str, Any]]
- get_products_links(*args, **kwargs)[source]¶
Query products links from server.
- Parameters:
project_name (
str
) – Project where links are.product_ids (
Optional[Iterable[str]]
) – Ids of products for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info by product ids.
- Return type:
dict[str, list[dict[str, Any]]]
- get_project(*args, **kwargs)[source]¶
Get project.
- Parameters:
project_name (
str
) – Name of project.fields (
Optional[Iterable[str]]
) – fields to be queried for project.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
- Project entity data or None
if project was not found.
- Return type:
Union[dict[str, Any], None]
- get_project_anatomy_preset(*args, **kwargs)[source]¶
Anatomy preset values by name.
Get anatomy preset values by preset name. Primary preset is returned if preset name is set to ‘None’.
- Parameters:
preset_name (
Optional[str]
) – Preset name.- Returns:
Anatomy preset values.
- Return type:
dict[str, Any]
- get_project_anatomy_presets()[source]¶
Anatomy presets available on server.
Content has basic information about presets. Example output:
[ { "name": "netflix_VFX", "primary": false, "version": "1.0.0" }, { ... }, ... ]
- Returns:
Anatomy presets available on server.
- Return type:
list[dict[str, str]]
- get_project_names(*args, **kwargs)[source]¶
Receive available project names.
User must be logged in.
- Parameters:
active (
Optional[bool]
) – Filter active/inactive projects. Both are returned if ‘None’ is passed.library (
Optional[bool]
) – Filter standard/library projects. Both are returned if ‘None’ is passed.
- Returns:
List of available project names.
- Return type:
list[str]
- get_project_product_types(*args, **kwargs)[source]¶
Types of products available on a project.
Filter only product types available on project.
- Parameters:
project_name (
str
) – Name of project where to look for product types.fields (
Optional[Iterable[str]]
) – Product types fields to query.
- Returns:
Product types information.
- Return type:
list[dict[str, Any]]
- get_project_root_overrides(*args, **kwargs)[source]¶
Root overrides per site name.
- Method is based on logged user and can’t be received for any other
user on server.
Output will contain only roots per site id used by logged user.
- Parameters:
project_name (
str
) – Name of project.- Returns:
Root values by root name by site id.
- Return type:
dict[str, dict[str, str]]
- get_project_root_overrides_by_site_id(*args, **kwargs)[source]¶
Root overrides for site.
If site id is not passed a site set in current api object is used instead.
- Parameters:
project_name (
str
) – Name of project.site_id (
Optional[str]
) – Site id for which want to receive site overrides.
- Returns:
- Root values by root name or None if
site does not have overrides.
- Return type:
dict[str, str]
- get_project_roots_by_platform(*args, **kwargs)[source]¶
Root values for a site.
If platform name is not passed current platform name is used instead.
- This function does return root values without site overrides. It is
possible to use the function to receive default root values.
- Parameters:
project_name (
str
) – Name of project.platform_name (
Optional[Literal["windows", "linux", "darwin"]]
) – Platform name for which want to receive root values. Current platform name is used if not passed.
- Returns:
Root values.
- Return type:
dict[str, str]
- get_project_roots_by_site(*args, **kwargs)[source]¶
Root overrides per site name.
Method is based on logged user and can’t be received for any other user on server.
Output will contain only roots per site id used by logged user.
- Deprecated:
- Use ‘get_project_root_overrides’ instead. Function
deprecated since 1.0.6
- Parameters:
project_name (
str
) – Name of project.- Returns:
Root values by root name by site id.
- Return type:
dict[str, dict[str, str]]
- get_project_roots_by_site_id(*args, **kwargs)[source]¶
Root values for a site.
If site id is not passed a site set in current api object is used instead. If site id is not available, default roots are returned for current platform.
- Parameters:
project_name (
str
) – Name of project.site_id (
Optional[str]
) – Site id for which want to receive root values.
- Returns:
Root values.
- Return type:
dict[str, str]
- get_project_roots_for_site(*args, **kwargs)[source]¶
Root overrides for site.
If site id is not passed a site set in current api object is used instead.
- Deprecated:
- Use ‘get_project_root_overrides_by_site_id’ instead. Function
deprecated since 1.0.6
- Parameters:
project_name (
str
) – Name of project.site_id (
Optional[str]
) – Site id for which want to receive site overrides.
- Returns:
- Root values by root name, root name is not
available if it does not have overrides.
- Return type:
dict[str, str]
- get_projects(*args, **kwargs)[source]¶
Get projects.
- Parameters:
active (
Optional[bool]
) – Filter active or inactive projects. Filter is disabled when ‘None’ is passed.library (
Optional[bool]
) – Filter library projects. Filter is disabled when ‘None’ is passed.fields (
Optional[Iterable[str]]
) – fields to be queried for project.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
Queried projects.
- Return type:
Generator[dict[str, Any]]
- get_repre_ids_by_context_filters(*args, **kwargs)[source]¶
Find representation ids which match passed context filters.
Each representation has context integrated on representation entity in database. The context may contain project, folder, task name or product name, product type and many more. This implementation gives option to quickly filter representation based on representation data in database.
- Context filters have defined structure. To define filter of nested
subfield use dot ‘.’ as delimiter (For example ‘task.name’).
- Filter values can be regex filters. String or
re.Pattern
can be used.
- Parameters:
project_name (
str
) – Project where to look for representations.context_filters (
dict[str, list[str]]
) – Filters of context fields.representation_names (
Optional[Iterable[str]]
) – Representation names, can be used as additional filter for representations by their names.version_ids (
Optional[Iterable[str]]
) – Version ids, can be used as additional filter for representations by their parent ids.
- Returns:
Representation ids that match passed filters.
- Return type:
list[str]
Example
- The function returns just representation ids so if entities are
required for funtionality they must be queried afterwards by their ids.
>>> project_name = "testProject" >>> filters = { ... "task.name": ["[aA]nimation"], ... "product": [".*[Mm]ain"] ... } >>> repre_ids = get_repre_ids_by_context_filters( ... project_name, filters) >>> repres = get_representations(project_name, repre_ids)
- get_representation_by_id(*args, **kwargs)[source]¶
Query representation entity from server based on id filter.
- Parameters:
project_name (
str
) – Project where to look for representation.representation_id (
str
) – Id of representation.fields (
Optional[Iterable[str]]
) – fields to be queried for representations.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for representations.
- Returns:
Queried representation entity or None.
- Return type:
Union[dict[str, Any], None]
- get_representation_by_name(*args, **kwargs)[source]¶
Query representation entity by name and version id.
- Parameters:
project_name (
str
) – Project where to look for representation.representation_name (
str
) – Representation name.version_id (
str
) – Version id.fields (
Optional[Iterable[str]]
) – fields to be queried for representations.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for representations.
- Returns:
Queried representation entity or None.
- Return type:
Union[dict[str, Any], None]
- get_representation_hierarchy(*args, **kwargs)[source]¶
Find representation parents by representation id.
Representation parent entities up to project.
- Parameters:
project_name (
str
) – Project where to look for entities.representation_id (
str
) – Representation id.project_fields (
Optional[Iterable[str]]
) – Project fields.folder_fields (
Optional[Iterable[str]]
) – Folder fields.task_fields (
Optional[Iterable[str]]
) – Task fields.product_fields (
Optional[Iterable[str]]
) – Product fields.version_fields (
Optional[Iterable[str]]
) – Version fields.representation_fields (
Optional[Iterable[str]]
) – Representation fields.
- Returns:
Representation hierarchy entities.
- Return type:
- get_representation_links(*args, **kwargs)[source]¶
Query representation links from server.
- Parameters:
project_name (
str
) – Project where links are.representation_id (
str
) – Representation id for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info of representation.
- Return type:
list[dict[str, Any]]
- get_representation_parents(*args, **kwargs)[source]¶
Find representation parents by representation id.
Representation parent entities up to project.
- Parameters:
project_name (
str
) – Project where to look for entities.representation_id (
str
) – Representation id.project_fields (
Optional[Iterable[str]]
) – Project fields.folder_fields (
Optional[Iterable[str]]
) – Folder fields.product_fields (
Optional[Iterable[str]]
) – Product fields.version_fields (
Optional[Iterable[str]]
) – Version fields.
- Returns:
Representation parent entities.
- Return type:
- get_representations(*args, **kwargs)[source]¶
Get representation entities based on passed filters from server.
- Parameters:
project_name (
str
) – Name of project where to look for versions.representation_ids (
Optional[Iterable[str]]
) – Representation ids used for representation filtering.representation_names (
Optional[Iterable[str]]
) – Representation names used for representation filtering.version_ids (
Optional[Iterable[str]]
) – Version ids used for representation filtering. Versions are parents of representations.names_by_version_ids (
Optional[bool]
) – Find representations by names and version ids. This filter discard all other filters.statuses (
Optional[Iterable[str]]
) – Representation statuses used for filtering.tags (
Optional[Iterable[str]]
) – Representation tags used for filtering.active (
Optional[bool]
) – Receive active/inactive entities. Both are returned when ‘None’ is passed.has_links (
Optional[Literal[IN, OUT, ANY]]
) – Filter representations with IN/OUT/ANY links.fields (
Optional[Iterable[str]]
) – Fields to be queried for representation. All possible fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for representations.
- Returns:
Queried representation entities.
- Return type:
Generator[dict[str, Any]]
- get_representations_hierarchy(*args, **kwargs)[source]¶
Find representation with parents by representation id.
Representation entity with parent entities up to project.
- Default fields are used when any fields are set to None. But it is
possible to pass in empty iterable (list, set, tuple) to skip entity.
- Parameters:
project_name (
str
) – Project where to look for entities.representation_ids (
Iterable[str]
) – Representation ids.project_fields (
Optional[Iterable[str]]
) – Project fields.folder_fields (
Optional[Iterable[str]]
) – Folder fields.task_fields (
Optional[Iterable[str]]
) – Task fields.product_fields (
Optional[Iterable[str]]
) – Product fields.version_fields (
Optional[Iterable[str]]
) – Version fields.representation_fields (
Optional[Iterable[str]]
) – Representation fields.
- Returns:
- Parent entities by
representation id.
- Return type:
dict[str, RepresentationHierarchy]
- get_representations_links(*args, **kwargs)[source]¶
Query representations links from server.
- Parameters:
project_name (
str
) – Project where links are.representation_ids (
Optional[Iterable[str]]
) – Ids of representations for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info by representation ids.
- Return type:
dict[str, list[dict[str, Any]]]
- get_representations_parents(*args, **kwargs)[source]¶
Find representations parents by representation id.
Representation parent entities up to project.
- Parameters:
project_name (
str
) – Project where to look for entities.representation_ids (
Iterable[str]
) – Representation ids.project_fields (
Optional[Iterable[str]]
) – Project fields.folder_fields (
Optional[Iterable[str]]
) – Folder fields.product_fields (
Optional[Iterable[str]]
) – Product fields.version_fields (
Optional[Iterable[str]]
) – Version fields.
- Returns:
- Parent entities by
representation id.
- Return type:
dict[str, RepresentationParents]
- get_rest_entity_by_id(*args, **kwargs)[source]¶
Get entity using REST on a project by its id.
- Parameters:
project_name (
str
) – Name of project where entity is.entity_type (
Literal["folder", "task", "product", "version"]
) – The entity type which should be received.entity_id (
str
) – Id of entity.
- Returns:
Received entity data.
- Return type:
dict[str, Any]
- get_rest_folders(*args, **kwargs)[source]¶
Get simplified flat list of all project folders.
- Get all project folders in single REST call. This can be faster than
using ‘get_folders’ method which is using GraphQl, but does not allow any filtering, and set of fields is defined by server backend.
Example:
[ { "id": "112233445566", "parentId": "112233445567", "path": "/root/parent/child", "parents": ["root", "parent"], "name": "child", "label": "Child", "folderType": "Folder", "hasTasks": False, "hasChildren": False, "taskNames": [ "Compositing", ], "status": "In Progress", "attrib": {}, "ownAttrib": [], "updatedAt": "2023-06-12T15:37:02.420260", }, ... ]
- Parameters:
project_name (
str
) – Project name.include_attrib (
Optional[bool]
) – Include attribute values in output. Slower to query.
- Returns:
List of folder entities.
- Return type:
list[dict[str, Any]]
- get_rest_project(*args, **kwargs)[source]¶
Query project by name.
This call returns project with anatomy data.
- Parameters:
project_name (
str
) – Name of project.- Returns:
- Project entity data or ‘None’ if
project was not found.
- Return type:
Union[dict[str, Any], None]
- get_rest_projects(*args, **kwargs)[source]¶
Query available project entities.
User must be logged in.
- Parameters:
active (
Optional[bool]
) – Filter active/inactive projects. Both are returned if ‘None’ is passed.library (
Optional[bool]
) – Filter standard/library projects. Both are returned if ‘None’ is passed.
- Returns:
Available projects.
- Return type:
Generator[dict[str, Any]]
- get_schemas()[source]¶
Get components schema.
Name of components does not match entity type names e.g. ‘project’ is under ‘ProjectModel’. We should find out some mapping. Also, there are properties which don’t have information about reference to object e.g. ‘config’ has just object definition without reference schema.
- Returns:
Component schemas.
- Return type:
dict[str, Any]
- get_secret(*args, **kwargs)[source]¶
Get secret by name.
Example output:
{ "name": "secret_name", "value": "secret_value", }
- Parameters:
secret_name (
str
) – Name of secret.- Returns:
Secret entity data.
- Return type:
dict[str, str]
- get_secrets()[source]¶
Get all secrets.
Example output:
[ { "name": "secret_1", "value": "secret_value_1", }, { "name": "secret_2", "value": "secret_value_2", } ]
- Returns:
List of secret entities.
- Return type:
list[dict[str, str]]
- get_sender()[source]¶
Sender used to send requests.
- Returns:
Sender name or None.
- Return type:
Union[str, None]
- get_server_api_connection()[source]¶
Access to global scope object of GlobalServerAPI.
This access expect to have set environment variables ‘AYON_SERVER_URL’ and ‘AYON_API_KEY’.
- Returns:
Object of connection to server.
- Return type:
- get_server_schema()[source]¶
Get server schema with info, url paths, components etc.
- Todos:
Cache schema - How to find out it is outdated?
- Returns:
Full server schema.
- Return type:
dict[str, Any]
- get_server_version()[source]¶
Get server version.
Version should match semantic version (https://semver.org/).
- Returns:
Server version.
- Return type:
str
- get_server_version_tuple()[source]¶
Get server version as tuple.
Version should match semantic version (https://semver.org/).
This function only returns first three numbers of version.
- Returns:
- Server
version.
- Return type:
Tuple[int, int, int, Union[str, None], Union[str, None]]
- get_service_addon_name()[source]¶
Name of addon which initialized service connection.
Service context must be initialized to be able to use this function. Call ‘init_service’ on you service start to do so.
- Returns:
Name of addon or None.
- Return type:
Union[str, None]
- get_service_addon_settings(project_name=None)[source]¶
Addon settings of service which initialized service.
Service context must be initialized to be able to use this function. Call ‘init_service’ on you service start to do so.
- Parameters:
project_name (
Optional[str]
) – Project name.- Returns:
Addon settings.
- Return type:
Dict[str, Any]
- Raises:
ValueError – When service was not initialized.
- get_service_addon_version()[source]¶
Version of addon which initialized service connection.
Service context must be initialized to be able to use this function. Call ‘init_service’ on you service start to do so.
- Returns:
Version of addon or None.
- Return type:
Union[str, None]
- get_service_name()[source]¶
Name of service.
Service context must be initialized to be able to use this function. Call ‘init_service’ on you service start to do so.
- Returns:
Name of service if service was registered.
- Return type:
Union[str, None]
- get_site_id()[source]¶
Site id used for connection.
Site id tells server from which machine/site is connection created and is used for default site overrides when settings are received.
- Returns:
Site id value or None if not filled.
- Return type:
Union[str, None]
- get_ssl_verify()[source]¶
Enable ssl verification.
- Returns:
Current state of ssl verification.
- Return type:
bool
- get_task_by_folder_path(*args, **kwargs)[source]¶
Query task entity by folder path and task name.
- Parameters:
project_name (
str
) – Project name.folder_path (
str
) – Folder path.task_name (
str
) – Task name.fields (
Optional[Iterable[str]]
) – Task fields that should be returned.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
- Task entity data or None if was
not found.
- Return type:
Union[dict[str, Any], None]
- get_task_by_id(*args, **kwargs)[source]¶
Query task entity by id.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.task_id (
str
) – Task id.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
Task entity data or None if was not found.
- Return type:
Union[dict, None]
- get_task_by_name(*args, **kwargs)[source]¶
Query task entity by name and folder id.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.folder_id (
str
) – Folder id.task_name (
str
) – Task namefields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
Task entity data or None if was not found.
- Return type:
Union[dict, None]
- get_task_links(*args, **kwargs)[source]¶
Query task links from server.
- Parameters:
project_name (
str
) – Project where links are.task_id (
str
) – Task id for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info of task.
- Return type:
list[dict[str, Any]]
- get_tasks(*args, **kwargs)[source]¶
Query task entities from server.
- Parameters:
project_name (
str
) – Name of project.task_ids (
Iterable[str]
) – Task ids to filter.task_names (
Iterable[str]
) – Task names used for filtering.task_types (
Iterable[str]
) – Task types used for filtering.folder_ids (
Iterable[str]
) – Ids of task parents. Use ‘None’ if folder is direct child of project.assignees (
Optional[Iterable[str]]
) – Task assignees used for filtering. All tasks with any of passed assignees are returned.assignees_all (
Optional[Iterable[str]]
) – Task assignees used for filtering. Task must have all of passed assignees to be returned.statuses (
Optional[Iterable[str]]
) – Task statuses used for filtering.tags (
Optional[Iterable[str]]
) – Task tags used for filtering.active (
Optional[bool]
) – Filter active/inactive tasks. Both are returned if is set to None.fields (
Optional[Iterable[str]]
) – Fields to be queried for folder. All possible folder fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
Queried task entities.
- Return type:
Generator[dict[str, Any]]
- get_tasks_by_folder_path(*args, **kwargs)[source]¶
Query task entities from server by folder path.
- Parameters:
project_name (
str
) – Name of project.folder_path (
str
) – Folder path.task_names (
Iterable[str]
) – Task names used for filtering.task_types (
Iterable[str]
) – Task types used for filtering.assignees (
Optional[Iterable[str]]
) – Task assignees used for filtering. All tasks with any of passed assignees are returned.assignees_all (
Optional[Iterable[str]]
) – Task assignees used for filtering. Task must have all of passed assignees to be returned.statuses (
Optional[Iterable[str]]
) – Task statuses used for filtering.tags (
Optional[Iterable[str]]
) – Task tags used for filtering.active (
Optional[bool]
) – Filter active/inactive tasks. Both are returned if is set to None.fields (
Optional[Iterable[str]]
) – Fields to be queried for folder. All possible folder fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- get_tasks_by_folder_paths(*args, **kwargs)[source]¶
Query task entities from server by folder paths.
- Parameters:
project_name (
str
) – Name of project.folder_paths (
list[str]
) – Folder paths.task_names (
Iterable[str]
) – Task names used for filtering.task_types (
Iterable[str]
) – Task types used for filtering.assignees (
Optional[Iterable[str]]
) – Task assignees used for filtering. All tasks with any of passed assignees are returned.assignees_all (
Optional[Iterable[str]]
) – Task assignees used for filtering. Task must have all of passed assignees to be returned.statuses (
Optional[Iterable[str]]
) – Task statuses used for filtering.tags (
Optional[Iterable[str]]
) – Task tags used for filtering.active (
Optional[bool]
) – Filter active/inactive tasks. Both are returned if is set to None.fields (
Optional[Iterable[str]]
) – Fields to be queried for folder. All possible folder fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – Attribute values that are not explicitly set on entity will have ‘None’ value.
- Returns:
- Task entities by
folder path.
- Return type:
dict[dict[str, list[dict[str, Any]]]
- get_tasks_links(*args, **kwargs)[source]¶
Query tasks links from server.
- Parameters:
project_name (
str
) – Project where links are.task_ids (
Optional[Iterable[str]]
) – Ids of tasks for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info by task ids.
- Return type:
dict[str, list[dict[str, Any]]]
- get_thumbnail(*args, **kwargs)[source]¶
Get thumbnail from server.
Permissions of thumbnails are related to entities so thumbnails must be queried per entity. So an entity type and entity type is required to be passed.
Notes
- It is recommended to use one of prepared entity type specific
methods ‘get_folder_thumbnail’, ‘get_version_thumbnail’ or ‘get_workfile_thumbnail’.
- We do recommend pass thumbnail id if you have access to it. Each
entity that allows thumbnails has ‘thumbnailId’ field, so it can be queried.
- Parameters:
project_name (
str
) – Project under which the entity is located.entity_type (
str
) – Entity type which passed entity id represents.entity_id (
str
) – Entity id for which thumbnail should be returned.thumbnail_id (
Optional[str]
) – DEPRECATED Use ‘get_thumbnail_by_id’.
- Returns:
- Thumbnail content wrapper. Does not have to be
valid.
- Return type:
- get_thumbnail_by_id(*args, **kwargs)[source]¶
Get thumbnail from server by id.
Permissions of thumbnails are related to entities so thumbnails must be queried per entity. So an entity type and entity type is required to be passed.
Notes
- It is recommended to use one of prepared entity type specific
methods ‘get_folder_thumbnail’, ‘get_version_thumbnail’ or ‘get_workfile_thumbnail’.
- We do recommend pass thumbnail id if you have access to it. Each
entity that allows thumbnails has ‘thumbnailId’ field, so it can be queried.
- Parameters:
project_name (
str
) – Project under which the entity is located.thumbnail_id (
Optional[str]
) – DEPRECATED Use ‘get_thumbnail_by_id’.
- Returns:
- Thumbnail content wrapper. Does not have to be
valid.
- Return type:
- get_timeout()[source]¶
Current value for requests timeout.
- Returns:
Timeout value in seconds.
- Return type:
float
- get_user(*args, **kwargs)[source]¶
Get user info using REST endpoit.
- Parameters:
username (
Optional[str]
) – Username.- Returns:
- User info or None if user is not
found.
- Return type:
Union[dict[str, Any], None]
- get_user_by_name(*args, **kwargs)[source]¶
Get user by name using GraphQl.
- Only administrators and managers can fetch all users. For other users
it is required to pass in ‘project_name’ filter.
- Parameters:
username (
str
) – Username.project_name (
Optional[str]
) – Define scope of project.fields (
Optional[Iterable[str]]
) – Fields to be queried for users.
- Returns:
- User info or None if user is not
found.
- Return type:
Union[dict[str, Any], None]
- get_user_by_token(url, token, timeout=None)[source]¶
Get user information by url and token.
- Parameters:
url (
str
) – Server url.token (
str
) – User’s token.timeout (
Optional[float]
) – Timeout for request. Value from ‘get_default_timeout’ is used if not specified.
- Returns:
User information if url and token are valid.
- Return type:
Optional[Dict[str, Any]]
- get_users(*args, **kwargs)[source]¶
Get Users.
- Only administrators and managers can fetch all users. For other users
it is required to pass in ‘project_name’ filter.
- Parameters:
project_name (
Optional[str]
) – Project name.usernames (
Optional[Iterable[str]]
) – Filter by usernames.fields (
Optional[Iterable[str]]
) – Fields to be queried for users.
- Returns:
Queried users.
- Return type:
Generator[dict[str, Any]]
- get_version_by_id(*args, **kwargs)[source]¶
Query version entity by id.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.version_id (
str
) – Version id.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for versions.
- Returns:
Version entity data or None if was not found.
- Return type:
Union[dict, None]
- get_version_by_name(*args, **kwargs)[source]¶
Query version entity by version and product id.
- Parameters:
project_name (
str
) – Name of project where to look for queried entities.version (
int
) – Version of version entity.product_id (
str
) – Product id. Product is a parent of version.fields (
Optional[Iterable[str]]
) – Fields that should be returned. All fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for versions.
- Returns:
Version entity data or None if was not found.
- Return type:
Union[dict, None]
- get_version_links(*args, **kwargs)[source]¶
Query version links from server.
- Parameters:
project_name (
str
) – Project where links are.version_id (
str
) – Version id for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info of version.
- Return type:
list[dict[str, Any]]
- get_version_thumbnail(*args, **kwargs)[source]¶
Prepared method to receive thumbnail for version entity.
- Parameters:
project_name (
str
) – Project under which the entity is located.version_id (
str
) – Version id for which thumbnail should be returned.thumbnail_id (
Optional[str]
) – Prepared thumbnail id from entity. Used only to check if thumbnail was already cached.
- Returns:
- Path to downloaded thumbnail or none if entity
does not have any (or if user does not have permissions).
- Return type:
Union[str, None]
- get_versions(*args, **kwargs)[source]¶
Get version entities based on passed filters from server.
- Parameters:
project_name (
str
) – Name of project where to look for versions.version_ids (
Optional[Iterable[str]]
) – Version ids used for version filtering.product_ids (
Optional[Iterable[str]]
) – Product ids used for version filtering.task_ids (
Optional[Iterable[str]]
) – Task ids used for version filtering.versions (
Optional[Iterable[int]]
) – Versions we’re interested in.hero (
Optional[bool]
) – Skip hero versions when set to False.standard (
Optional[bool]
) – Skip standard (non-hero) when set to False.latest (
Optional[bool]
) – Return only latest version of standard versions. This can be combined only with ‘standard’ attribute set to True.statuses (
Optional[Iterable[str]]
) – Representation statuses used for filtering.tags (
Optional[Iterable[str]]
) – Representation tags used for filtering.active (
Optional[bool]
) – Receive active/inactive entities. Both are returned when ‘None’ is passed.fields (
Optional[Iterable[str]]
) – Fields to be queried for version. All possible folder fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for versions.
- Returns:
Queried version entities.
- Return type:
Generator[dict[str, Any]]
- get_versions_links(*args, **kwargs)[source]¶
Query versions links from server.
- Parameters:
project_name (
str
) – Project where links are.version_ids (
Optional[Iterable[str]]
) – Ids of versions for which links should be received.link_types (
Optional[Iterable[str]]
) – Link type filters.link_direction (
Optional[Literal["in", "out"]]
) – Link direction filter.
- Returns:
Link info by version ids.
- Return type:
dict[str, list[dict[str, Any]]]
- get_workfile_info(*args, **kwargs)[source]¶
Workfile info entity by task id and workfile path.
- Parameters:
project_name (
str
) – Project under which the entity is located.task_id (
str
) – Task id.path (
str
) – Rootless workfile path.fields (
Optional[Iterable[str]]
) – Fields to be queried for representation. All possible fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for workfiles.
- Returns:
Workfile info entity or None.
- Return type:
Union[dict[str, Any], None]
- get_workfile_info_by_id(*args, **kwargs)[source]¶
Workfile info entity by id.
- Parameters:
project_name (
str
) – Project under which the entity is located.workfile_id (
str
) – Workfile info id.fields (
Optional[Iterable[str]]
) – Fields to be queried for representation. All possible fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for workfiles.
- Returns:
Workfile info entity or None.
- Return type:
Union[dict[str, Any], None]
- get_workfile_thumbnail(*args, **kwargs)[source]¶
Prepared method to receive thumbnail for workfile entity.
- Parameters:
project_name (
str
) – Project under which the entity is located.workfile_id (
str
) – Worfile id for which thumbnail should be returned.thumbnail_id (
Optional[str]
) – Prepared thumbnail id from entity. Used only to check if thumbnail was already cached.
- Returns:
- Path to downloaded thumbnail or none if entity
does not have any (or if user does not have permissions).
- Return type:
Union[str, None]
- get_workfiles_info(*args, **kwargs)[source]¶
Workfile info entities by passed filters.
- Parameters:
project_name (
str
) – Project under which the entity is located.workfile_ids (
Optional[Iterable[str]]
) – Workfile ids.task_ids (
Optional[Iterable[str]]
) – Task ids.paths (
Optional[Iterable[str]]
) – Rootless workfiles paths.path_regex (
Optional[str]
) – Regex filter for workfile path.statuses (
Optional[Iterable[str]]
) – Workfile info statuses used for filtering.tags (
Optional[Iterable[str]]
) – Workfile info tags used for filtering.has_links (
Optional[Literal[IN, OUT, ANY]]
) – Filter representations with IN/OUT/ANY links.fields (
Optional[Iterable[str]]
) – Fields to be queried for representation. All possible fields are returned if ‘None’ is passed.own_attributes (
Optional[bool]
) – DEPRECATED: Not supported for workfiles.
- Returns:
Queried workfile info entites.
- Return type:
Generator[dict[str, Any]]
- init_service(*args, **kwargs)[source]¶
Initialize current connection from service.
The service expect specific environment variables. The variables must all be set to make the connection work as a service.
- is_connection_created()[source]¶
Is global connection created.
- Returns:
True if connection was connected.
- Return type:
bool
- is_service_user()[source]¶
Check if connection is using service API key.
- Returns:
Used api key belongs to service user.
- Return type:
bool
- is_token_valid(url, token, timeout=None)[source]¶
Check if token is valid.
Token can be a user token or service api key.
- Parameters:
url (
str
) – Server url.token (
str
) – User’s token.timeout (
Optional[float]
) – Timeout for request. Value from ‘get_default_timeout’ is used if not specified.
- Returns:
True if token is valid.
- Return type:
bool
- login_to_server(url, username, password, timeout=None)[source]¶
Use login to the server to receive token.
- Parameters:
url (
str
) – Server url.username (
str
) – User’s username.password (
str
) – User’s password.timeout (
Optional[float]
) – Timeout for request. Value from ‘get_default_timeout’ is used if not specified.
- Returns:
- User’s token if login was successfull.
Otherwise ‘None’.
- Return type:
Union[str, None]
- make_sure_link_type_exists(*args, **kwargs)[source]¶
Make sure link type exists on a project.
- Parameters:
project_name (
str
) – Name of project.link_type_name (
str
) – Name of link type.input_type (
str
) – Input entity type of link.output_type (
str
) – Output entity type of link.data (
Optional[dict[str, Any]]
) – Link type related data.
- query_graphql(*args, **kwargs)[source]¶
Execute GraphQl query.
- Parameters:
query (
str
) – GraphQl query string.variables (
Optional[dict[str, Any]
) – Variables that can be used in query.
- Returns:
Response from server.
- Return type:
- remove_attribute_config(*args, **kwargs)[source]¶
Remove attribute from server.
This can’t be un-done, please use carefully.
- Parameters:
attribute_name (
str
) – Name of attribute to remove.
- save_secret(*args, **kwargs)[source]¶
Save secret.
This endpoint can create and update secret.
- Parameters:
secret_name (
str
) – Name of secret.secret_value (
str
) – Value of secret.
- send_batch_operations(*args, **kwargs)[source]¶
Post multiple CRUD operations to server.
When multiple changes should be made on server side this is the best way to go. It is possible to pass multiple operations to process on a server side and do the changes in a transaction.
- Parameters:
project_name (
str
) – On which project should be operations processed.operations (
list[dict[str, Any]]
) – Operations to be processed.can_fail (
Optional[bool]
) – Server will try to process all operations even if one of them fails.raise_on_fail (
Optional[bool]
) – Raise exception if an operation fails. You can handle failed operations on your own when set to ‘False’.
- Raises:
ValueError – Operations can’t be converted to json string.
FailedOperations – When output does not contain server operations or ‘raise_on_fail’ is enabled and any operation fails.
- Returns:
Operations result with process details.
- Return type:
list[dict[str, Any]]
- set_cert(*args, **kwargs)[source]¶
Change cert file used for connection to server.
- Parameters:
cert (
Union[str, None]
) – Path to cert file.
- set_client_version(*args, **kwargs)[source]¶
Set version of client used to connect to server.
Client version is AYON client build desktop application.
- Parameters:
client_version (
Union[str, None]
) – Client version string.
- set_default_settings_variant(*args, **kwargs)[source]¶
Change default variant for addon settings.
Note
- It is recommended to set only ‘production’ or ‘staging’ variants
as default variant.
- Parameters:
variant (
str
) – Settings variant name. It is possible to use ‘production’, ‘staging’ or name of dev bundle.
- set_environments(url, token)[source]¶
Set global environments for global connection.
- Parameters:
url (
Union[str, None]
) – Url to server or None to unset environments.token (
Union[str, None]
) – API key token to be used for connection.
- set_max_retries(*args, **kwargs)[source]¶
Change max retries value for requests.
- Parameters:
max_retries (
Union[int, None]
) – Max retries value.
- set_sender(*args, **kwargs)[source]¶
Change sender used for requests.
- Parameters:
sender (
Union[str, None]
) – Sender name or None.
- set_site_id(*args, **kwargs)[source]¶
Change site id of connection.
Behave as specific site for server. It affects default behavior of settings getter methods.
- Parameters:
site_id (
Union[str, None]
) – Site id value, or ‘None’ to unset.
- set_ssl_verify(*args, **kwargs)[source]¶
Change ssl verification state.
- Parameters:
ssl_verify (
Union[bool, str, None]
) – Enabled/disable ssl verification, can be a path to file.
- set_timeout(*args, **kwargs)[source]¶
Change timeout value for requests.
- Parameters:
timeout (
Union[float, None]
) – Timeout value in seconds.
- slugify_string(input_string, separator='_', slug_whitelist='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', split_chars=' ,./\\;:!|*^#@~+-_=', min_length=1, lower=False, make_set=False)[source]¶
Slugify a text string.
This function removes transliterates input string to ASCII, removes special characters and use join resulting elements using specified separator.
- Parameters:
input_string (
str
) – Input string to slugifyseparator (
str
) – A string used to separate returned elements (default: “_”)slug_whitelist (
str
) – Characters allowed in the output (default: ascii letters, digits and the separator)split_chars (
str
) – Set of characters used for word splitting (there is a sane default)lower (
bool
) – Convert to lower-case (default: False)make_set (
bool
) – Return “set” object instead of string.min_length (
int
) – Minimal length of an element (word).
- Returns:
- Based on ‘make_set’ value returns slugified
string.
- Return type:
Union[str, Set[str]]
- take_web_action_event(server_url: str, action_token: str) Dict[str, Any] [source]¶
Take web action event using action token.
Action token is generated by AYON server and passed to AYON launcher.
- Parameters:
server_url (
str
) – AYON server url.action_token (
str
) – Action token.
- Returns:
Web action event.
- Return type:
Dict[str, Any]
- trigger_server_restart()[source]¶
Trigger server restart.
Restart may be required when a change of specific value happened on server.
- update_bundle(*args, **kwargs)[source]¶
Update bundle on server.
Dependency packages can be update only for single platform. Others will be left untouched. Use ‘None’ value to unset dependency package from bundle.
- Parameters:
bundle_name (
str
) – Name of bundle.addon_versions (
Optional[dict[str, str]]
) – Addon versions, possible only for dev bundles.installer_version (
Optional[str]
) – Installer version, possible only for dev bundles.dependency_packages (
Optional[dict[str, str]]
) – Dependency pacakge names that should be used with the bundle.is_production (
Optional[bool]
) – Bundle will be marked as production.is_staging (
Optional[bool]
) – Bundle will be marked as staging.is_dev (
Optional[bool]
) – Bundle will be marked as dev.dev_active_user (
Optional[str]
) – Username that will be assigned to dev bundle. Can be used only for dev bundles.dev_addons_config (
Optional[dict[str, Any]]
) – Configuration for dev addons. Can be used only for dev bundles.
- update_dependency_package(*args, **kwargs)[source]¶
Update dependency package metadata on server.
- Parameters:
filename (
str
) – Filename of dependency package.sources (
list[dict[str, Any]]
) – Information about sources from where it is possible to get file. Fully replaces existing sources.
- update_event(*args, **kwargs)[source]¶
Update event data.
- Parameters:
event_id (
str
) – Event id.sender (
Optional[str]
) – New sender of event.project_name (
Optional[str]
) – New project name.username (
Optional[str]
) – New username.status (
Optional[str]
) – New event status. Enum: “pending”, “in_progress”, “finished”, “failed”, “aborted”, “restarted”description (
Optional[str]
) – New description.summary (
Optional[dict[str, Any]]
) – New summary.payload (
Optional[dict[str, Any]]
) – New payload.progress (
Optional[int]
) – New progress. Range [0-100].retries (
Optional[int]
) – New retries.
- update_folder(*args, **kwargs)[source]¶
Update folder entity on server.
- Do not pass
parent_id
,label
amdthumbnail_id
if you don’t want to change their values. Value
None
would unset their value.
Update of
data
will override existing value on folder entity.- Update of
attrib
does change only passed attributes. If you want to unset value, use
None
.
- Parameters:
project_name (
str
) – Project name.folder_id (
str
) – Folder id.name (
Optional[str]
) – New name.folder_type (
Optional[str]
) – New folder type.parent_id (
Optional[Union[str, None]]
) – New parent folder id.label (
Optional[Union[str, None]]
) – New label.attrib (
Optional[dict[str, Any]]
) – New attributes.data (
Optional[dict[str, Any]]
) – New data.tags (
Optional[Iterable[str]]
) – New tags.status (
Optional[str]
) – New status.active (
Optional[bool]
) – New active state.thumbnail_id (
Optional[Union[str, None]]
) – New thumbnail id.
- Do not pass
- update_installer(*args, **kwargs)[source]¶
Update installer information on server.
- Parameters:
filename (
str
) – Installer filename.sources (
list[dict[str, Any]]
) – List of sources that can be used to download file. Fully replaces existing sources.
- update_product(*args, **kwargs)[source]¶
Update product entity on server.
Update of
data
will override existing value on folder entity.- Update of
attrib
does change only passed attributes. If you want to unset value, use
None
.
- Parameters:
project_name (
str
) – Project name.product_id (
str
) – Product id.name (
Optional[str]
) – New product name.folder_id (
Optional[str]
) – New product id.product_type (
Optional[str]
) – New product type.attrib (
Optional[dict[str, Any]]
) – New product attributes.data (
Optional[dict[str, Any]]
) – New product data.tags (
Optional[Iterable[str]]
) – New product tags.status (
Optional[str]
) – New product status.active (
Optional[bool]
) – New product active state.
- Update of
- update_project(*args, **kwargs)[source]¶
Update project entity on server.
- Parameters:
project_name (
str
) – Name of project.library (
Optional[bool]
) – Change library state.folder_types (
Optional[list[dict[str, Any]]]
) – Folder type definitions.task_types (
Optional[list[dict[str, Any]]]
) – Task type definitions.link_types (
Optional[list[dict[str, Any]]]
) – Link type definitions.statuses (
Optional[list[dict[str, Any]]]
) – Status definitions.tags (
Optional[list[dict[str, Any]]]
) – List of tags available to set on entities.config (
Optional[dict[dict[str, Any]]]
) – Project anatomy config with templates and roots.attrib (
Optional[dict[str, Any]]
) – Project attributes to change.data (
Optional[dict[str, Any]]
) – Custom data of a project. This value will 100% override project data.active (
Optional[bool]
) – Change active state of a project.project_code (
Optional[str]
) – Change project code. Not recommended during production.**changes – Other changed keys based on Rest API documentation.
- update_representation(*args, **kwargs)[source]¶
Update representation entity on server.
Update of
data
will override existing value on folder entity.- Update of
attrib
does change only passed attributes. If you want to unset value, use
None
.
- Parameters:
project_name (
str
) – Project name.representation_id (
str
) – Representation id.name (
Optional[str]
) – New name.version_id (
Optional[str]
) – New version id.files (
Optional[list[dict]]
) – New files information.attrib (
Optional[dict[str, Any]]
) – New attributes.data (
Optional[dict[str, Any]]
) – New data.tags (
Optional[Iterable[str]]
) – New tags.status (
Optional[str]
) – New status.active (
Optional[bool]
) – New active state.
- Update of
- update_task(*args, **kwargs)[source]¶
Update task entity on server.
- Do not pass
label
amdthumbnail_id
if you don’t want to change their values. Value
None
would unset their value.
Update of
data
will override existing value on folder entity.- Update of
attrib
does change only passed attributes. If you want to unset value, use
None
.
- Parameters:
project_name (
str
) – Project name.task_id (
str
) – Task id.name (
Optional[str]
) – New name.task_type (
Optional[str]
) – New task type.folder_id (
Optional[str]
) – New folder id.label (
Optional[Union[str, None]]
) – New label.assignees (
Optional[str]
) – New assignees.attrib (
Optional[dict[str, Any]]
) – New attributes.data (
Optional[dict[str, Any]]
) – New data.tags (
Optional[Iterable[str]]
) – New tags.status (
Optional[str]
) – New status.active (
Optional[bool]
) – New active state.thumbnail_id (
Optional[Union[str, None]]
) – New thumbnail id.
- Do not pass
- update_thumbnail(*args, **kwargs)[source]¶
Change thumbnail content by id.
Update can be also used to create new thumbnail.
- Parameters:
project_name (
str
) – Project where the thumbnail will be created and can be used.thumbnail_id (
str
) – Thumbnail id to update.src_filepath (
str
) – Filepath to thumbnail which should be uploaded.
- Raises:
ValueError – When thumbnail source cannot be processed.
- update_version(*args, **kwargs)[source]¶
Update version entity on server.
- Do not pass
task_id
amdthumbnail_id
if you don’t want to change their values. Value
None
would unset their value.
Update of
data
will override existing value on folder entity.- Update of
attrib
does change only passed attributes. If you want to unset value, use
None
.
- Parameters:
project_name (
str
) – Project name.version_id (
str
) – Version id.version (
Optional[int]
) – New version.product_id (
Optional[str]
) – New product id.task_id (
Optional[Union[str, None]]
) – New task id.author (
Optional[str]
) – New author username.attrib (
Optional[dict[str, Any]]
) – New attributes.data (
Optional[dict[str, Any]]
) – New data.tags (
Optional[Iterable[str]]
) – New tags.status (
Optional[str]
) – New status.active (
Optional[bool]
) – New active state.thumbnail_id (
Optional[Union[str, None]]
) – New thumbnail id.
- Do not pass
- upload_addon_zip(*args, **kwargs)[source]¶
Upload addon zip file to server.
- File is validated on server. If it is valid, it is installed. It will
create an event job which can be tracked (tracking part is not implemented yet).
Example output:
{'eventId': 'a1bfbdee27c611eea7580242ac120003'}
- Parameters:
src_filepath (
str
) – Path to a zip file.progress (
Optional[TransferProgress]
) – Object to keep track about upload state.
- Returns:
Response data from server.
- Return type:
dict[str, Any]
- upload_dependency_package(*args, **kwargs)[source]¶
Upload dependency package to server.
- Parameters:
src_filepath (
str
) – Path to a package file.dst_filename (
str
) – Dependency package filename or name of package for server version 0.2.0 or lower. Must be unique.platform_name (
Optional[str]
) – Deprecated.progress (
Optional[TransferProgress]
) – Object to keep track about upload state.
- upload_file(*args, **kwargs)[source]¶
Upload file to server.
- Todos:
Use retries and timeout. Return RestApiResponse.
- Parameters:
endpoint (
str
) – Endpoint or url where file will be uploaded.filepath (
str
) – Source filepath.progress (
Optional[TransferProgress]
) – Object that gives ability to track upload progress.request_type (
Optional[RequestType]
) – Type of request that will be used to upload file.**kwargs (
Any
) – Additional arguments that will be passed to request function.
- Returns:
Response object
- Return type:
requests.Response
- upload_file_from_stream(*args, **kwargs)[source]¶
Upload file to server from bytes.
- Todos:
Use retries and timeout. Return RestApiResponse.
- Parameters:
endpoint (
str
) – Endpoint or url where file will be uploaded.stream (
Union[io.BytesIO, BinaryIO]
) – File content stream.progress (
Optional[TransferProgress]
) – Object that gives ability to track upload progress.request_type (
Optional[RequestType]
) – Type of request that will be used to upload file.**kwargs (
Any
) – Additional arguments that will be passed to request function.
- Returns:
Response object
- Return type:
requests.Response
- upload_installer(*args, **kwargs)[source]¶
Upload installer file to server.
- Parameters:
src_filepath (
str
) – Source filepath.dst_filename (
str
) – Destination filename.progress (
Optional[TransferProgress]
) – Object that gives ability to track download progress.
- Returns:
Response object.
- Return type:
requests.Response
- upload_reviewable(*args, **kwargs)[source]¶
Upload reviewable file to server.
- Parameters:
project_name (
str
) – Project name.version_id (
str
) – Version id.filepath (
str
) – Reviewable file path to upload.label (
Optional[str]
) – Reviewable label. Filled automatically server side with filename.content_type (
Optional[str]
) – MIME type of the file.filename (
Optional[str]
) – User as original filename. Filename from ‘filepath’ is used when not filled.progress (
Optional[TransferProgress]
) – Progress.headers (
Optional[Dict[str, Any]]
) – Headers.
- Returns:
Server response.
- Return type:
- validate_url(url, timeout=None)[source]¶
Validate url if is valid and server is available.
Validation checks if can be parsed as url and contains scheme.
Function will try to autofix url thus will return modified url when connection to server works.
my_url = "my.server.url" try: # Store new url validated_url = validate_url(my_url) except UrlError: # Handle invalid url ...
- Parameters:
url (
str
) – Server url.timeout (
Optional[int]
) – Timeout in seconds for connection to server.
- Returns:
Url which was used to connect to server.
- Raises:
UrlError – Error with short description and hints for user.
- version_is_latest(*args, **kwargs)[source]¶
Is version latest from a product.
- Parameters:
project_name (
str
) – Project where to look for representation.version_id (
str
) – Version id.
- Returns:
Version is latest or not.
- Return type:
bool
Submodules¶
- ayon_api.constants module
- ayon_api.entity_hub module
AttributeValue
Attributes
BaseEntity
BaseEntity.add_child()
BaseEntity.attribs
BaseEntity.changes
BaseEntity.children
BaseEntity.children_ids
BaseEntity.created
BaseEntity.data
BaseEntity.entity_type
BaseEntity.fill_children_ids()
BaseEntity.from_entity_data()
BaseEntity.get_children()
BaseEntity.get_children_ids()
BaseEntity.get_name()
BaseEntity.get_parent()
BaseEntity.get_parent_id()
BaseEntity.get_thumbnail_id()
BaseEntity.has_cached_immutable_hierarchy
BaseEntity.id
BaseEntity.immutable_for_hierarchy
BaseEntity.lock()
BaseEntity.name
BaseEntity.orig_parent_id
BaseEntity.parent
BaseEntity.parent_entity_types
BaseEntity.parent_id
BaseEntity.project_name
BaseEntity.remove_child()
BaseEntity.removed
BaseEntity.reset_immutable_for_hierarchy_cache()
BaseEntity.set_name()
BaseEntity.set_parent()
BaseEntity.set_parent_id()
BaseEntity.set_thumbnail_id()
BaseEntity.thumbnail_id
BaseEntity.to_create_body_data()
EntityData
EntityHub
EntityHub.add_entity()
EntityHub.add_folder()
EntityHub.add_new_folder()
EntityHub.add_new_task()
EntityHub.add_task()
EntityHub.allow_data_changes
EntityHub.commit_changes()
EntityHub.delete_entity()
EntityHub.entities
EntityHub.fill_project_from_server()
EntityHub.folder_path_reseted()
EntityHub.get_attributes_for_type()
EntityHub.get_entity_by_id()
EntityHub.get_entity_children()
EntityHub.get_folder_by_id()
EntityHub.get_or_query_entity_by_id()
EntityHub.get_task_by_id()
EntityHub.lock()
EntityHub.path_start_with_slash
EntityHub.project_entity
EntityHub.project_name
EntityHub.query_entities_from_server()
EntityHub.reset_immutable_for_hierarchy_cache()
EntityHub.set_entity_parent()
EntityHub.unset_entity_parent()
FolderEntity
FolderEntity.changes
FolderEntity.entity_type
FolderEntity.folder_type
FolderEntity.from_entity_data()
FolderEntity.get_folder_type()
FolderEntity.get_has_published_content()
FolderEntity.get_label()
FolderEntity.get_path()
FolderEntity.get_status()
FolderEntity.get_tags()
FolderEntity.has_published_content
FolderEntity.label
FolderEntity.lock()
FolderEntity.parent_entity_types
FolderEntity.path
FolderEntity.reset_path()
FolderEntity.set_folder_type()
FolderEntity.set_has_published_content()
FolderEntity.set_label()
FolderEntity.set_status()
FolderEntity.set_tags()
FolderEntity.status
FolderEntity.tags
FolderEntity.to_create_body_data()
ProjectEntity
ProjectEntity.changes
ProjectEntity.default_folder_type_icon
ProjectEntity.default_task_type_icon
ProjectEntity.entity_type
ProjectEntity.folder_types
ProjectEntity.from_entity_data()
ProjectEntity.get_folder_types()
ProjectEntity.get_orig_folder_types()
ProjectEntity.get_orig_statuses()
ProjectEntity.get_orig_task_types()
ProjectEntity.get_parent()
ProjectEntity.get_status_by_slugified_name()
ProjectEntity.get_statuses()
ProjectEntity.get_task_types()
ProjectEntity.lock()
ProjectEntity.parent
ProjectEntity.parent_entity_types
ProjectEntity.set_folder_types()
ProjectEntity.set_parent()
ProjectEntity.set_status_scope_supported()
ProjectEntity.set_statuses()
ProjectEntity.set_task_types()
ProjectEntity.statuses
ProjectEntity.task_types
ProjectEntity.to_create_body_data()
ProjectStatus
ProjectStatus.changed
ProjectStatus.color
ProjectStatus.color_regex
ProjectStatus.default_color
ProjectStatus.default_state
ProjectStatus.delete()
ProjectStatus.from_data()
ProjectStatus.get_color()
ProjectStatus.get_icon()
ProjectStatus.get_index()
ProjectStatus.get_name()
ProjectStatus.get_project_statuses()
ProjectStatus.get_scope()
ProjectStatus.get_short_name()
ProjectStatus.get_state()
ProjectStatus.icon
ProjectStatus.index
ProjectStatus.is_available_for_entity_type()
ProjectStatus.lock()
ProjectStatus.move_after()
ProjectStatus.move_before()
ProjectStatus.name
ProjectStatus.project_statuses
ProjectStatus.scope
ProjectStatus.set_color()
ProjectStatus.set_icon()
ProjectStatus.set_index()
ProjectStatus.set_name()
ProjectStatus.set_project_statuses()
ProjectStatus.set_scope()
ProjectStatus.set_short_name()
ProjectStatus.set_state()
ProjectStatus.short_name
ProjectStatus.slugified_name
ProjectStatus.slugify_name()
ProjectStatus.state
ProjectStatus.to_data()
ProjectStatus.unset_project_statuses()
ProjectStatus.valid_scope
ProjectStatus.valid_states
TaskEntity
TaskEntity.add_child()
TaskEntity.assignees
TaskEntity.changes
TaskEntity.entity_type
TaskEntity.from_entity_data()
TaskEntity.get_assignees()
TaskEntity.get_label()
TaskEntity.get_status()
TaskEntity.get_tags()
TaskEntity.get_task_type()
TaskEntity.label
TaskEntity.lock()
TaskEntity.parent_entity_types
TaskEntity.set_assignees()
TaskEntity.set_label()
TaskEntity.set_status()
TaskEntity.set_tags()
TaskEntity.set_task_type()
TaskEntity.status
TaskEntity.tags
TaskEntity.task_type
TaskEntity.to_create_body_data()
- ayon_api.events module
- ayon_api.exceptions module
- ayon_api.graphql module
BaseGraphQlQueryField
BaseGraphQlQueryField.add_field()
BaseGraphQlQueryField.add_field_with_edges()
BaseGraphQlQueryField.add_obj_field()
BaseGraphQlQueryField.add_variable()
BaseGraphQlQueryField.calculate_query()
BaseGraphQlQueryField.child_has_edges
BaseGraphQlQueryField.child_indent
BaseGraphQlQueryField.get_filters()
BaseGraphQlQueryField.get_variable()
BaseGraphQlQueryField.get_variable_value()
BaseGraphQlQueryField.has_edges
BaseGraphQlQueryField.has_filter()
BaseGraphQlQueryField.indent
BaseGraphQlQueryField.need_query
BaseGraphQlQueryField.offset
BaseGraphQlQueryField.parse_result()
BaseGraphQlQueryField.path
BaseGraphQlQueryField.query_item
BaseGraphQlQueryField.remove_filter()
BaseGraphQlQueryField.reset_cursor()
BaseGraphQlQueryField.set_filter()
BaseGraphQlQueryField.set_parent()
BaseGraphQlQueryField.set_variable_value()
BaseGraphQlQueryField.sum_edge_fields()
GraphQlQuery
GraphQlQuery.add_field()
GraphQlQuery.add_field_with_edges()
GraphQlQuery.add_obj_field()
GraphQlQuery.add_variable()
GraphQlQuery.calculate_query()
GraphQlQuery.child_indent
GraphQlQuery.continuous_query()
GraphQlQuery.get_variable()
GraphQlQuery.get_variable_keys()
GraphQlQuery.get_variable_value()
GraphQlQuery.get_variables_values()
GraphQlQuery.has_multiple_edge_fields
GraphQlQuery.indent
GraphQlQuery.need_query
GraphQlQuery.offset
GraphQlQuery.parse_result()
GraphQlQuery.query()
GraphQlQuery.set_variable_value()
GraphQlQueryEdgeField
GraphQlQueryEdgeField.add_edge_field()
GraphQlQueryEdgeField.add_obj_edge_field()
GraphQlQueryEdgeField.add_obj_field()
GraphQlQueryEdgeField.calculate_query()
GraphQlQueryEdgeField.child_indent
GraphQlQueryEdgeField.get_filters()
GraphQlQueryEdgeField.has_edges
GraphQlQueryEdgeField.parse_result()
GraphQlQueryEdgeField.reset_cursor()
GraphQlQueryField
QueryVariable
fields_to_dict()
- ayon_api.graphql_queries module
add_links_fields()
events_graphql_query()
folders_graphql_query()
product_types_query()
products_graphql_query()
project_graphql_query()
project_product_types_query()
projects_graphql_query()
representations_graphql_query()
representations_hierarchy_qraphql_query()
representations_parents_qraphql_query()
tasks_by_folder_paths_graphql_query()
tasks_graphql_query()
users_graphql_query()
versions_graphql_query()
workfiles_info_graphql_query()
- ayon_api.operations module
AbstractOperation
CreateOperation
DeleteOperation
OperationsSession
OperationsSession.add()
OperationsSession.append()
OperationsSession.clear()
OperationsSession.commit()
OperationsSession.con
OperationsSession.create_entity()
OperationsSession.create_folder()
OperationsSession.create_product()
OperationsSession.create_representation()
OperationsSession.create_task()
OperationsSession.create_version()
OperationsSession.delete_entity()
OperationsSession.delete_folder()
OperationsSession.delete_product()
OperationsSession.delete_representation()
OperationsSession.delete_task()
OperationsSession.delete_version()
OperationsSession.extend()
OperationsSession.get_project()
OperationsSession.remove()
OperationsSession.to_data()
OperationsSession.update_entity()
OperationsSession.update_folder()
OperationsSession.update_product()
OperationsSession.update_representation()
OperationsSession.update_task()
OperationsSession.update_version()
UpdateOperation
new_folder_entity()
new_hero_version_entity()
new_product_entity()
new_representation_entity()
new_version_entity()
new_workfile_info()
prepare_changes()
- ayon_api.server_api module
GraphQlResponse
RequestType
RequestTypes
RestApiResponse
ServerAPI
ServerAPI.access_token
ServerAPI.as_username()
ServerAPI.base_url
ServerAPI.cert
ServerAPI.check_bundle_compatibility()
ServerAPI.client_version
ServerAPI.close_session()
ServerAPI.create_bundle()
ServerAPI.create_dependency_package()
ServerAPI.create_folder()
ServerAPI.create_installer()
ServerAPI.create_link()
ServerAPI.create_link_type()
ServerAPI.create_product()
ServerAPI.create_project()
ServerAPI.create_representation()
ServerAPI.create_session()
ServerAPI.create_task()
ServerAPI.create_thumbnail()
ServerAPI.create_version()
ServerAPI.default_download_chunk_size
ServerAPI.default_settings_variant
ServerAPI.default_upload_chunk_size
ServerAPI.delete()
ServerAPI.delete_bundle()
ServerAPI.delete_dependency_package()
ServerAPI.delete_folder()
ServerAPI.delete_installer()
ServerAPI.delete_link()
ServerAPI.delete_link_type()
ServerAPI.delete_product()
ServerAPI.delete_project()
ServerAPI.delete_representation()
ServerAPI.delete_secret()
ServerAPI.delete_task()
ServerAPI.delete_version()
ServerAPI.dispatch_event()
ServerAPI.download_addon_private_file()
ServerAPI.download_dependency_package()
ServerAPI.download_file()
ServerAPI.download_file_to_stream()
ServerAPI.download_installer()
ServerAPI.enroll_event_job()
ServerAPI.get()
ServerAPI.get_addon_endpoint()
ServerAPI.get_addon_project_settings()
ServerAPI.get_addon_settings()
ServerAPI.get_addon_settings_schema()
ServerAPI.get_addon_site_settings()
ServerAPI.get_addon_site_settings_schema()
ServerAPI.get_addon_studio_settings()
ServerAPI.get_addon_url()
ServerAPI.get_addons_info()
ServerAPI.get_addons_project_settings()
ServerAPI.get_addons_settings()
ServerAPI.get_addons_studio_settings()
ServerAPI.get_attributes_fields_for_type()
ServerAPI.get_attributes_for_type()
ServerAPI.get_attributes_schema()
ServerAPI.get_base_url()
ServerAPI.get_build_in_anatomy_preset()
ServerAPI.get_bundle_settings()
ServerAPI.get_bundles()
ServerAPI.get_cert()
ServerAPI.get_client_version()
ServerAPI.get_default_anatomy_preset_name()
ServerAPI.get_default_fields_for_type()
ServerAPI.get_default_max_retries()
ServerAPI.get_default_service_username()
ServerAPI.get_default_settings_variant()
ServerAPI.get_default_timeout()
ServerAPI.get_dependency_packages()
ServerAPI.get_entities_links()
ServerAPI.get_event()
ServerAPI.get_events()
ServerAPI.get_folder_by_id()
ServerAPI.get_folder_by_name()
ServerAPI.get_folder_by_path()
ServerAPI.get_folder_ids_with_products()
ServerAPI.get_folder_links()
ServerAPI.get_folder_thumbnail()
ServerAPI.get_folders()
ServerAPI.get_folders_hierarchy()
ServerAPI.get_folders_links()
ServerAPI.get_folders_rest()
ServerAPI.get_full_link_type_name()
ServerAPI.get_graphql_schema()
ServerAPI.get_headers()
ServerAPI.get_hero_version_by_id()
ServerAPI.get_hero_version_by_product_id()
ServerAPI.get_hero_versions()
ServerAPI.get_info()
ServerAPI.get_installers()
ServerAPI.get_last_version_by_product_id()
ServerAPI.get_last_version_by_product_name()
ServerAPI.get_last_versions()
ServerAPI.get_link_type()
ServerAPI.get_link_types()
ServerAPI.get_max_retries()
ServerAPI.get_product_by_id()
ServerAPI.get_product_by_name()
ServerAPI.get_product_links()
ServerAPI.get_product_type_names()
ServerAPI.get_product_types()
ServerAPI.get_products()
ServerAPI.get_products_links()
ServerAPI.get_project()
ServerAPI.get_project_anatomy_preset()
ServerAPI.get_project_anatomy_presets()
ServerAPI.get_project_names()
ServerAPI.get_project_product_types()
ServerAPI.get_project_root_overrides()
ServerAPI.get_project_root_overrides_by_site_id()
ServerAPI.get_project_roots_by_platform()
ServerAPI.get_project_roots_by_site()
ServerAPI.get_project_roots_by_site_id()
ServerAPI.get_project_roots_for_site()
ServerAPI.get_projects()
ServerAPI.get_repre_ids_by_context_filters()
ServerAPI.get_representation_by_id()
ServerAPI.get_representation_by_name()
ServerAPI.get_representation_hierarchy()
ServerAPI.get_representation_links()
ServerAPI.get_representation_parents()
ServerAPI.get_representations()
ServerAPI.get_representations_hierarchy()
ServerAPI.get_representations_links()
ServerAPI.get_representations_parents()
ServerAPI.get_rest_entity_by_id()
ServerAPI.get_rest_folder()
ServerAPI.get_rest_folders()
ServerAPI.get_rest_product()
ServerAPI.get_rest_project()
ServerAPI.get_rest_projects()
ServerAPI.get_rest_representation()
ServerAPI.get_rest_task()
ServerAPI.get_rest_url()
ServerAPI.get_rest_version()
ServerAPI.get_schemas()
ServerAPI.get_secret()
ServerAPI.get_secrets()
ServerAPI.get_sender()
ServerAPI.get_server_schema()
ServerAPI.get_server_version()
ServerAPI.get_server_version_tuple()
ServerAPI.get_site_id()
ServerAPI.get_ssl_verify()
ServerAPI.get_task_by_folder_path()
ServerAPI.get_task_by_id()
ServerAPI.get_task_by_name()
ServerAPI.get_task_links()
ServerAPI.get_tasks()
ServerAPI.get_tasks_by_folder_path()
ServerAPI.get_tasks_by_folder_paths()
ServerAPI.get_tasks_links()
ServerAPI.get_thumbnail()
ServerAPI.get_thumbnail_by_id()
ServerAPI.get_timeout()
ServerAPI.get_user()
ServerAPI.get_user_by_name()
ServerAPI.get_users()
ServerAPI.get_version_by_id()
ServerAPI.get_version_by_name()
ServerAPI.get_version_links()
ServerAPI.get_version_thumbnail()
ServerAPI.get_versions()
ServerAPI.get_versions_links()
ServerAPI.get_workfile_info()
ServerAPI.get_workfile_info_by_id()
ServerAPI.get_workfile_thumbnail()
ServerAPI.get_workfiles_info()
ServerAPI.graphql_allows_data_in_query
ServerAPI.has_valid_token
ServerAPI.is_server_available
ServerAPI.is_service_user()
ServerAPI.log
ServerAPI.login()
ServerAPI.logout()
ServerAPI.make_sure_link_type_exists()
ServerAPI.max_retries
ServerAPI.patch()
ServerAPI.post()
ServerAPI.put()
ServerAPI.query_graphql()
ServerAPI.raw_delete()
ServerAPI.raw_get()
ServerAPI.raw_patch()
ServerAPI.raw_post()
ServerAPI.raw_put()
ServerAPI.remove_attribute_config()
ServerAPI.reset_attributes_schema()
ServerAPI.reset_token()
ServerAPI.rest_url
ServerAPI.save_secret()
ServerAPI.send_batch_operations()
ServerAPI.sender
ServerAPI.server_version
ServerAPI.server_version_tuple
ServerAPI.set_attribute_config()
ServerAPI.set_cert()
ServerAPI.set_client_version()
ServerAPI.set_default_service_username()
ServerAPI.set_default_settings_variant()
ServerAPI.set_max_retries()
ServerAPI.set_sender()
ServerAPI.set_site_id()
ServerAPI.set_ssl_verify()
ServerAPI.set_timeout()
ServerAPI.set_token()
ServerAPI.site_id
ServerAPI.ssl_verify
ServerAPI.timeout
ServerAPI.trigger_server_restart()
ServerAPI.update_bundle()
ServerAPI.update_dependency_package()
ServerAPI.update_event()
ServerAPI.update_folder()
ServerAPI.update_installer()
ServerAPI.update_product()
ServerAPI.update_project()
ServerAPI.update_representation()
ServerAPI.update_task()
ServerAPI.update_thumbnail()
ServerAPI.update_version()
ServerAPI.upload_addon_zip()
ServerAPI.upload_dependency_package()
ServerAPI.upload_file()
ServerAPI.upload_file_from_stream()
ServerAPI.upload_installer()
ServerAPI.upload_reviewable()
ServerAPI.validate_server_availability()
ServerAPI.validate_token()
ServerAPI.version_is_latest()
fill_own_attribs()
- ayon_api.utils module
RepresentationHierarchy
RepresentationParents
ThumbnailContent
TransferProgress
TransferProgress.add_transferred_chunk()
TransferProgress.content_size
TransferProgress.destination_url
TransferProgress.fail_reason
TransferProgress.failed
TransferProgress.get_content_size()
TransferProgress.get_destination_url()
TransferProgress.get_fail_reason()
TransferProgress.get_failed()
TransferProgress.get_source_url()
TransferProgress.get_started()
TransferProgress.get_transfer_done()
TransferProgress.get_transferred_size()
TransferProgress.is_running
TransferProgress.set_content_size()
TransferProgress.set_destination_url()
TransferProgress.set_failed()
TransferProgress.set_source_url()
TransferProgress.set_started()
TransferProgress.set_transfer_done()
TransferProgress.set_transferred_size()
TransferProgress.source_url
TransferProgress.started
TransferProgress.transfer_done
TransferProgress.transfer_progress
TransferProgress.transferred_size
abort_web_action_event()
convert_entity_id()
convert_or_create_entity_id()
create_dependency_package_basename()
create_entity_id()
entity_data_json_default()
failed_json_default()
get_default_settings_variant()
get_default_site_id()
get_default_timeout()
get_media_mime_type()
get_media_mime_type_for_content()
get_user_by_token()
is_token_valid()
login_to_server()
logout_from_server()
prepare_attribute_changes()
prepare_entity_changes()
prepare_query_string()
slugify_string()
take_web_action_event()
validate_url()
- ayon_api.version module