v15.1.5
pip install balena-sdkhttps://github.com/balena-io/balena-sdk-python>>> from balena import Balena
>>> balena = Balena()
>>> credentials = {'username':<your email>, 'password':<your password>}
>>> balena.auth.login(**credentials)
...balena = Balena({
"balena_host": "balena-cloud.com",
"api_version": "v7",
"device_actions_endpoint_version": "v1",
"data_directory": "/home/example/.balena",
"image_cache_time": str(1 * 1000 * 60 * 60 * 24 * 7), # 1 week
"token_refresh_interval": str(1 * 1000 * 60 * 60), # 1 hour
"timeout": str(30 * 1000), # request timeout, 30s
"request_limit": str(300), # the number of requests per request_limit_interval that the SDK should respect, defaults to unlimited.
"request_limit_interval": str(60), # the timespan that the request_limit should apply to in seconds, defaults to 60s (1 minute).
"retry_rate_limited_request": False, # awaits and retry once a request is rate limited (429)
})Table of Contents
Models
Application
Function: create(name, device_type, organization, application_class) ⇒ TypeApplication
TypeApplicationFunction: disable_device_urls(slug_or_uuid_or_id) ⇒ None
NoneFunction: enable_device_urls(slug_or_uuid_or_id) ⇒ None
NoneFunction: generate_provisioning_key(slug_or_uuid_or_id, key_name, description, expiry_date) ⇒ str
strFunction: get(slug_or_uuid_or_id, options, context) ⇒ TypeApplication
TypeApplicationFunction: get_all(options, context) ⇒ List[TypeApplication]
List[TypeApplication]Function: get_all_by_organization(org_handle_or_id, options) ⇒ List[TypeApplication]
List[TypeApplication]Function: get_all_directly_accessible(options) ⇒ List[TypeApplication]
List[TypeApplication]Function: get_by_name(app_name, options, context) ⇒ TypeApplication
TypeApplicationFunction: get_dashboard_url(app_id) ⇒ str
strFunction: get_directly_accessible(slug_or_uuid_or_id, options) ⇒ TypeApplication
TypeApplicationFunction: get_id(slug_or_uuid_or_id) ⇒ int
intFunction: get_target_release_hash(slug_or_uuid_or_id) ⇒ Optional[str]
Optional[str]Function: get_with_device_service_details(slug_or_uuid_or_id, options) ⇒ TypeApplicationWithDeviceServiceDetails
TypeApplicationWithDeviceServiceDetailsFunction: grant_support_access(slug_or_uuid_or_id, expiry_timestamp) ⇒ None
NoneFunction: has(slug_or_uuid_or_id) ⇒ bool
boolFunction: has_any() ⇒ bool
boolFunction: is_tracking_latest_release(slug_or_uuid_or_id) ⇒ bool
boolFunction: pin_to_release(slug_or_uuid_or_id, full_release_hash) ⇒ None
NoneFunction: purge(app_id) ⇒ None
NoneFunction: reboot(app_id, options) ⇒ None
NoneFunction: remove(slug_or_uuid_or_id) ⇒ None
NoneFunction: rename(slug_or_uuid_or_id, new_name) ⇒ None
NoneFunction: restart(slug_or_uuid_or_id) ⇒ None
NoneFunction: revoke_support_access(slug_or_uuid_or_id) ⇒ None
NoneFunction: shutdown(app_id, options) ⇒ None
NoneFunction: track_latest_release(slug_or_uuid_or_id) ⇒ None
NoneFunction: will_track_new_releases(slug_or_uuid_or_id) ⇒ bool
boolApplicationTag
Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ List[BaseTagType]
List[BaseTagType]Function: remove(slug_or_uuid_or_id, tag_key) ⇒ None
NoneFunction: set(slug_or_uuid_or_id, tag_key, value) ⇒ None
NoneApplicationConfigVariable
Function: get(slug_or_uuid_or_id, env_var_name) ⇒ Optional[str]
Optional[str]Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ List[EnvironmentVariableBase]
List[EnvironmentVariableBase]Function: remove(slug_or_uuid_or_id, key) ⇒ None
NoneFunction: set(slug_or_uuid_or_id, env_var_name, value) ⇒ None
NoneApplicationEnvVariable
Function: get(slug_or_uuid_or_id, env_var_name) ⇒ Optional[str]
Optional[str]Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ List[EnvironmentVariableBase]
List[EnvironmentVariableBase]Function: remove(slug_or_uuid_or_id, key) ⇒ None
NoneFunction: set(slug_or_uuid_or_id, env_var_name, value) ⇒ None
NoneBuildEnvVariable
Function: get(slug_or_uuid_or_id, env_var_name) ⇒ Optional[str]
Optional[str]Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ List[EnvironmentVariableBase]
List[EnvironmentVariableBase]Function: remove(slug_or_uuid_or_id, key) ⇒ None
NoneFunction: set(slug_or_uuid_or_id, env_var_name, value) ⇒ None
NoneApplicationMembership
Function: change_role(membership_id, role_name) ⇒ None
NoneFunction: create(slug_or_uuid_or_id, username, role_name) ⇒ ApplicationMembershipType
ApplicationMembershipTypeFunction: get(membership_id, options) ⇒ ApplicationMembershipType
ApplicationMembershipTypeFunction: get_all(options) ⇒ List[ApplicationMembershipType]
List[ApplicationMembershipType]Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ List[ApplicationMembershipType]
List[ApplicationMembershipType]Function: remove(membership_id) ⇒ None
NoneApplicationInvite
Function: accept(invite_token) ⇒ None
NoneFunction: create(slug_or_uuid_or_id, options) ⇒ ApplicationInviteType
ApplicationInviteTypeFunction: get_all(options) ⇒ List[ApplicationInviteType]
List[ApplicationInviteType]Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ List[ApplicationInviteType]
List[ApplicationInviteType]Function: revoke(invite_id) ⇒ None
NoneDevice
Function: deactivate(uuid_or_id_or_ids) ⇒ None
NoneFunction: disable_device_url(uuid_or_id_or_ids) ⇒ None
NoneFunction: disable_local_mode(uuid_or_id) ⇒ None
NoneFunction: disable_lock_override(uuid_or_id) ⇒ None
NoneFunction: enable_device_url(uuid_or_id_or_ids) ⇒ None
NoneFunction: enable_local_mode(uuid_or_id) ⇒ None
NoneFunction: enable_lock_override(uuid_or_id) ⇒ None
NoneFunction: generate_device_key(uuid_or_id, name, description, expiry_date) ⇒ str
strFunction: generate_uuid() ⇒ str
strFunction: get(uuid_or_id, options) ⇒ TypeDevice
TypeDeviceFunction: get_all(options) ⇒ List[TypeDevice]
List[TypeDevice]Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ List[TypeDevice]
List[TypeDevice]Function: get_all_by_organization(handle_or_id, options) ⇒ List[TypeDevice]
List[TypeDevice]Function: get_application_info(uuid_or_id) ⇒ Any
AnyFunction: get_application_name(uuid_or_id) ⇒ str
strFunction: get_by_name(name, options) ⇒ List[TypeDevice]
List[TypeDevice]Function: get_dashboard_url(uuid) ⇒ None
NoneFunction: get_device_url(uuid_or_id) ⇒ str
strFunction: get_local_ip_address(uuid_or_id) ⇒ List[str]
List[str]Function: get_local_mode_support(uuid_or_id) ⇒ LocalModeResponse
LocalModeResponseFunction: get_mac_address(uuid_or_id) ⇒ List[str]
List[str]Function: get_metrics(uuid_or_id) ⇒ DeviceMetricsType
DeviceMetricsTypeFunction: get_name(uuid_or_id) ⇒ str
strFunction: get_os_update_status(uuid_or_id) ⇒ HUPStatusResponse
HUPStatusResponseFunction: get_status(uuid_or_id) ⇒ str
strFunction: get_supervisor_state(uuid_or_id) ⇒ SupervisorStateType
SupervisorStateTypeFunction: get_supervisor_target_state(uuid_or_id) ⇒ Any
AnyFunction: get_supervisor_target_state_for_app(slug_or_uuid_or_id, release) ⇒ Any
AnyFunction: get_with_service_details(uuid_or_id, options) ⇒ TypeDeviceWithServices
TypeDeviceWithServicesFunction: grant_support_access(uuid_or_id_or_ids, expiry_timestamp) ⇒ None
NoneFunction: has(uuid_or_id) ⇒ bool
boolFunction: has_device_url(uuid_or_id) ⇒ bool
boolFunction: has_lock_override(uuid_or_id) ⇒ bool
boolFunction: identify(uuid_or_id) ⇒ None
NoneFunction: is_in_local_mode(uuid_or_id) ⇒ bool
boolFunction: is_online(uuid_or_id) ⇒ bool
boolFunction: is_tracking_application_release(uuid_or_id) ⇒ bool
boolFunction: move(uuid_or_id, app_slug_or_uuid_or_id) ⇒ None
NoneFunction: pin_to_release(uuid_or_id, full_release_hash_or_id) ⇒ None
NoneFunction: ping(uuid_or_id) ⇒ None
NoneFunction: purge(uuid_or_id) ⇒ None
NoneFunction: reboot(uuid_or_id, force) ⇒ None
NoneFunction: register(application_slug_or_uuid_or_id, uuid, device_type_slug) ⇒ RegisterResponse
RegisterResponseFunction: remove(uuid_or_id_or_ids) ⇒ None
NoneFunction: rename(uuid_or_id, new_name) ⇒ None
NoneFunction: restart_application(uuid_or_id) ⇒ None
NoneFunction: restart_service(uuid_or_id, image_id) ⇒ None
NoneFunction: revoke_support_access(uuid_or_id_or_ids) ⇒ None
NoneFunction: set_custom_location(uuid_or_id_or_ids, location) ⇒ None
NoneFunction: set_note(uuid_or_id_or_ids, note) ⇒ None
NoneFunction: set_supervisor_release(uuid_or_id, supervisor_version_or_id) ⇒ None
NoneFunction: shutdown(uuid_or_id, force) ⇒ None
NoneFunction: start_application(uuid_or_id) ⇒ None
NoneFunction: start_os_update(uuid_or_id, target_os_version) ⇒ HUPStatusResponse
HUPStatusResponseFunction: start_service(uuid_or_id, image_id) ⇒ None
NoneFunction: stop_application(uuid_or_id) ⇒ None
NoneFunction: stop_service(uuid_or_id, image_id) ⇒ None
NoneFunction: track_application_release(uuid_or_id_or_ids) ⇒ None
NoneFunction: unset_custom_location(uuid_or_id_or_ids) ⇒ None
NoneFunction: update(uuid_or_id, force) ⇒ None
NoneDeviceTag
Function: get(uuid_or_id, tag_key) ⇒ Optional[str]
Optional[str]Function: get_all(options) ⇒ List[BaseTagType]
List[BaseTagType]Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ List[BaseTagType]
List[BaseTagType]Function: get_all_by_device(uuid_or_id, options) ⇒ List[BaseTagType]
List[BaseTagType]Function: remove(uuid_or_id, tag_key) ⇒ None
NoneFunction: set(uuid_or_id, tag_key, value) ⇒ None
NoneDeviceConfigVariable
Function: get(uuid_or_id, env_var_name) ⇒ Optional[str]
Optional[str]Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ List[EnvironmentVariableBase]
List[EnvironmentVariableBase]Function: get_all_by_device(uuid_or_id, options) ⇒ List[EnvironmentVariableBase]
List[EnvironmentVariableBase]Function: remove(uuid_or_id, key) ⇒ None
NoneFunction: set(uuid_or_id, env_var_name, value) ⇒ None
NoneDeviceEnvVariable
Function: get(uuid_or_id, env_var_name) ⇒ Optional[str]
Optional[str]Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ List[EnvironmentVariableBase]
List[EnvironmentVariableBase]Function: get_all_by_device(uuid_or_id, options) ⇒ List[EnvironmentVariableBase]
List[EnvironmentVariableBase]Function: remove(uuid_or_id, key) ⇒ None
NoneFunction: set(uuid_or_id, env_var_name, value) ⇒ None
NoneDeviceServiceEnvVariable
Function: get(uuid_or_id, service_name_or_id, key) ⇒ Optional[str]
Optional[str]Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ List[EnvironmentVariableBase]
List[EnvironmentVariableBase]Function: get_all_by_device(uuid_or_id, options) ⇒ List[EnvironmentVariableBase]
List[EnvironmentVariableBase]Function: remove(uuid_or_id, service_name_or_id, key) ⇒ None
NoneFunction: set(uuid_or_id, service_name_or_id, key, value) ⇒ None
NoneDeviceHistory
Function: get_all_by_application(slug_or_uuid_or_id, from_date, to_date, options) ⇒ List[DeviceHistoryType]
List[DeviceHistoryType]Function: get_all_by_device(uuid_or_id, from_date, to_date, options) ⇒ List[DeviceHistoryType]
List[DeviceHistoryType]DeviceType
Function: get(id_or_slug, options) ⇒ DeviceTypeType
DeviceTypeTypeFunction: get_all(options) ⇒ List[DeviceTypeType]
List[DeviceTypeType]Function: get_all_supported(options) ⇒ None
NoneFunction: get_by_slug_or_name(slug_or_name, options) ⇒ DeviceTypeType
DeviceTypeTypeFunction: get_name(slug) ⇒ str
strFunction: get_slug_by_name(name) ⇒ str
strApiKey
Function: create(name, description, expiry_date) ⇒ str
strFunction: get_all(options) ⇒ List[APIKeyType]
List[APIKeyType]Function: get_all_named_user_api_keys(options) ⇒ List[APIKeyType]
List[APIKeyType]Function: get_device_api_keys_by_device(uuid_or_id, options) ⇒ List[APIKeyType]
List[APIKeyType]Function: get_provisioning_api_keys_by_application(slug_or_uuid_or_id, options) ⇒ List[APIKeyType]
List[APIKeyType]Function: revoke(id) ⇒ None
NoneFunction: update(id, api_key_info) ⇒ None
NoneKey
Function: create(title, key) ⇒ SSHKeyType
SSHKeyTypeFunction: get(id) ⇒ SSHKeyType
SSHKeyTypeFunction: get_all(options) ⇒ List[SSHKeyType]
List[SSHKeyType]Function: remove(id) ⇒ None
NoneOrganization
Function: create(name, handle, logo_image) ⇒ OrganizationType
OrganizationTypeFunction: get(handle_or_id, options) ⇒ OrganizationType
OrganizationTypeFunction: get_all(options) ⇒ List[OrganizationType]
List[OrganizationType]Function: remove(handle_or_id) ⇒ None
NoneOrganizationMembership
Function: get(membership_id, options) ⇒ OrganizationMembershipType
OrganizationMembershipTypeFunction: get_all(options) ⇒ List[OrganizationMembershipType]
List[OrganizationMembershipType]Function: get_all_by_organization(handle_or_id, options) ⇒ List[OrganizationMembershipType]
List[OrganizationMembershipType]OrganizationMembershipTag
Function: get(membership_id, tag_key) ⇒ Optional[str]
Optional[str]Function: get_all(options) ⇒ List[OrganizationMembershipTagType]
List[OrganizationMembershipTagType]Function: get_all_by_organization(handle_or_id, options) ⇒ List[OrganizationMembershipTagType]
List[OrganizationMembershipTagType]Function: get_all_by_organization_membership(membership_id, options) ⇒ List[OrganizationMembershipTagType]
List[OrganizationMembershipTagType]Function: remove(membership_id, tag_key) ⇒ None
NoneFunction: set(membership_id, tag_key, value) ⇒ None
NoneOrganizationInvite
Function: accept(invite_token) ⇒ None
NoneFunction: create(handle_or_id, invitee, role_name, message) ⇒ OrganizationInviteType
OrganizationInviteTypeFunction: get_all(options) ⇒ List[OrganizationInviteType]
List[OrganizationInviteType]Function: get_all_by_organization(handle_or_id, options) ⇒ List[OrganizationInviteType]
List[OrganizationInviteType]Function: revoke(invite_id) ⇒ None
NoneDeviceOs
Function: download(device_type, version, options) ⇒ None
NoneFunction: get_all_os_versions(device_type, options) ⇒ None
NoneFunction: get_available_os_versions(device_type) ⇒ None
NoneFunction: get_config(slug_or_uuid_or_id, options) ⇒ None
NoneFunction: get_download_size(device_type, version) ⇒ float
floatFunction: get_max_satisfying_version(device_type, version_or_range, os_type) ⇒ Optional[str]
Optional[str]Function: get_supervisor_releases_for_cpu_architecture(cpu_architecture_slug_or_id, options) ⇒ List[ReleaseType]
List[ReleaseType]Function: get_supported_os_update_versions(device_type, current_version) ⇒ None
NoneFunction: is_architecture_compatible_with(os_architecture, application_architecture) ⇒ None
NoneFunction: is_supported_os_update(device_type, current_version, target_version) ⇒ bool
boolConfig
Function: get_all() ⇒ ConfigType
ConfigTypeRelease
Function: create_from_url(slug_or_uuid_or_id, url, flatten_tarball) ⇒ int
intFunction: finalize(commit_or_id_or_raw_version) ⇒ None
NoneFunction: get(commit_or_id_or_raw_version, options) ⇒ ReleaseType
ReleaseTypeFunction: get_all_by_application(slug_or_uuid_or_id, options) ⇒ List[ReleaseType]
List[ReleaseType]Function: get_latest_by_application(slug_or_uuid_or_id, options) ⇒ Optional[ReleaseType]
Optional[ReleaseType]Function: get_with_image_details(commit_or_id_or_raw_version, image_options, release_options) ⇒ ReleaseWithImageDetailsType
ReleaseWithImageDetailsTypeFunction: set_is_invalidated(commit_or_id_or_raw_version, is_invalidated) ⇒ None
NoneFunction: set_known_issue_list(commit_or_id_or_raw_version, known_issue_list) ⇒ None
NoneFunction: set_note(commit_or_id_or_raw_version, note) ⇒ None
NoneFunction: set_release_version(commit_or_id, semver) ⇒ None
NoneReleaseTag
Function: get(commit_or_id_or_raw_version, tag_key) ⇒ Optional[str]
Optional[str]Function: get_all(options) ⇒ List[BaseTagType]
List[BaseTagType]Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ List[BaseTagType]
List[BaseTagType]Function: get_all_by_release(commit_or_id_or_raw_version, options) ⇒ List[BaseTagType]
List[BaseTagType]Function: remove(commit_or_id_or_raw_version, tag_key) ⇒ None
NoneFunction: set(commit_or_id_or_raw_version, tag_key, value) ⇒ None
NoneService
Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ List[ServiceType]
List[ServiceType]ServiceEnvVariable
Function: get(service_id_or_natural_key, key) ⇒ Optional[str]
Optional[str]Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ List[EnvironmentVariableBase]
List[EnvironmentVariableBase]Function: get_all_by_service(service_id_or_natural_key, options) ⇒ List[EnvironmentVariableBase]
List[EnvironmentVariableBase]Function: remove(service_id_or_natural_key, key) ⇒ None
NoneFunction: set(service_id_or_natural_key, key, value) ⇒ None
NoneImage
Function: get(id, options) ⇒ ImageType
ImageTypeFunction: get_logs(id) ⇒ str
strAuth
Function: authenticate() ⇒ str
strFunction: get_actor_id() ⇒ int
intFunction: get_token() ⇒ Optional[str]
Optional[str]Function: get_user_info() ⇒ UserInfo
UserInfoFunction: is_logged_in() ⇒ bool
boolFunction: login() ⇒ None
NoneFunction: login_with_token(token) ⇒ None
NoneFunction: logout() ⇒ None
NoneFunction: register() ⇒ str
strFunction: whoami() ⇒ Union[UserKeyWhoAmIResponse, ApplicationKeyWhoAmIResponse, DeviceKeyWhoAmIResponse, None]
Union[UserKeyWhoAmIResponse, ApplicationKeyWhoAmIResponse, DeviceKeyWhoAmIResponse, None]TwoFactorAuth
Function: challenge(code) ⇒ None
NoneFunction: disable(password) ⇒ str
strFunction: enable(code) ⇒ str
strFunction: get_setup_key() ⇒ str
strFunction: is_enabled() ⇒ bool
boolFunction: is_passed() ⇒ bool
boolFunction: verify(code) ⇒ str
strLogs
Function: history(uuid_or_id, count) ⇒ List[Log]
List[Log]Function: stop() ⇒ None
NoneFunction: subscribe(uuid_or_id, callback, error, count) ⇒ None
NoneFunction: unsubscribe(uuid_or_id) ⇒ None
NoneFunction: unsubscribe_all() ⇒ None
NoneSettings
Types
APIKeyInfoType
APIKeyType
ActorType
ApplicationHostedOnApplication
ApplicationInviteType
ApplicationMembershipRoleType
ApplicationMembershipType
ApplicationType
BaseTagType
BasicUserInfoType
CpuArchitectureType
CreditBundleType
DeviceFamilyType
DeviceHistoryType
DeviceManufacturerType
DeviceMetricsType
DeviceTypeAliasType
DeviceTypeType
EnvironmentVariableBase
ImageBasicInfoType
ImageInstallType
ImageType
InviteeType
OrganizationInviteType
OrganizationMembershipRoleType
OrganizationMembershipTagType
OrganizationMembershipType
OrganizationPrivateDeviceTypeAccess
OrganizationType
PineDeferred
PublicDeviceType
PublicOrganizationType
ReleaseImageType
ReleaseType
ReleaseVersion
ReleaseWithImageDetailsType
SSHKeyType
ServiceInstanceType
ServiceType
TeamApplicationAccessType
TeamMembershipType
TeamType
TypeApplication
TypeApplicationWithDeviceServiceDetails
TypeCurrentService
TypeDevice
TypeDeviceWithServices
TypeVar
TypedDict
UserType
WebResource
Last updated
Was this helpful?