This is a Python library for interacting with Yandex DataSphere API. It provides functions to perform various operations such as getting organizations, billing accounts, projects, managing organization members, creating projects, checking operation status, and adding contributors to projects.
Install the current version with PyPI:
pip install etudatasphereOr from GitHub:
pip install https://github.com/sesh00/etudatasphere/archive/main.zipfrom etudatasphere import DataSphereManageroauth_token = ""
dataSphereManager = DataSphereManager(oauth_token)Retrieves a list of organizations and their identifiers.
dataSphereManager.get_organizations()Retrieves a list of possible roles in DataSphere.
dataSphereManager.get_possible_ds_roles()Retrieves a list of billing accounts.
dataSphereManager.get_billing_accounts()Retrieves members of a specific organization
org_id = "" # From the section with the request for organizations
dataSphereManager.get_organization_members(org_id)Retrieves communities of a specific organization.
org_id = "" # From the section with the request for organizations
dataSphereManager.get_organization_communities(org_id)Creates a project, adds contributors, and configures settings.
community_id = "" # From the section with the request for communities
name = "" # Project name
description = "" # Project description
vmInactivityTimeout = "100s" # Release resources in the specified format, where 300 is the number of seconds of inactivity
dataSphereManager.create_project(
community_id = community_id,
name = name,
description = description,
vmInactivityTimeout = vmInactivityTimeout)Checks the status of a specific operation.
id_operation = "" # Operation identifier from the section with project creation
dataSphereManager.check_operation_status(id_operation)
community_id = "" # From the section with project creation
dataSphereManager.get_projects(community_id=community_id)Retrieves information about projects.
project_id = "" # Identifier of the created project from the section with checking operation status
dataSphereManager.get_projects(project_id=project_id)Adds contributors to a project.
project_id = "" # Identifier of an existing project
contributors = [
{
"id": "", # Identifier of an organization member from the section with requesting members of a specific organization
"role":"datasphere.communities.admin" # Possible role of a member from the section with requesting role identifiers
},
{
"id": "",
"role": "datasphere.communities.admin"
}
]
dataSphereManager.add_contributors(project_id=project_id, contributors=contributors)community_id = ""
vm_inactivity_timeout = "100s"
unit_balance = 100
dataSphereManager.update_all_community_projects(community_id, vm_inactivity_timeout, unit_balance)project_id = ""
unit_balance = 100
print(dataSphereManager.get_unit_balance(project_id))
dataSphereManager.update_unit_balance(project_id, unit_balance)Contributions to EtuDataSphere are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on the GitHub repository
The module is available as open source under the terms of the MIT License