System
You can get information about system components, including cluster status and component health.
Status
import asyncio
from ptsandbox import Sandbox, SandboxKey
async def main():
sandbox = Sandbox(...)
await sandbox.ui.authorize()
status = await sandbox.ui.get_system_status()
print(status)
asyncio.run(main())
ptsandbox.sandbox.ui._system.SystemMixin.get_system_status
async
Get information about the system status
For full information, look at the documentation of the SandboxSystemStatusResponse model.
Returns:
-
SandboxSystemStatusResponse–A model with information about the system
Raises:
-
SandboxException–if not authorized or token refresh fails
-
ClientResponseError–if the server returns an error status
-
ClientError–on connection or transport errors
-
ValidationError–if the response body does not match the expected model
Cluster status
import asyncio
from ptsandbox import Sandbox, SandboxKey
async def main():
sandbox = Sandbox(...)
await sandbox.ui.authorize()
cluster = await sandbox.ui.get_system_cluster_status()
print(cluster)
asyncio.run(main())
ptsandbox.sandbox.ui._system.SystemMixin.get_system_cluster_status
async
Get information about the cluster status
Raises:
-
SandboxException–if not authorized or token refresh fails
-
ClientResponseError–if the server returns an error status
-
ClientError–on connection or transport errors
-
ValidationError–if the response body does not match the expected model
Components status
import asyncio
from ptsandbox import Sandbox, SandboxKey
async def main():
sandbox = Sandbox(...)
await sandbox.ui.authorize()
components = await sandbox.ui.get_system_components_status()
print(components)
asyncio.run(main())
ptsandbox.sandbox.ui._system.SystemMixin.get_system_components_status
async
Get information about the components status
Raises:
-
SandboxException–if not authorized or token refresh fails
-
ClientResponseError–if the server returns an error status
-
ClientError–on connection or transport errors
-
ValidationError–if the response body does not match the expected model
Settings
Get information
import asyncio
from ptsandbox import Sandbox, SandboxKey
async def main():
sandbox = Sandbox(...)
await sandbox.ui.authorize()
settings = await sandbox.ui.get_system_settings()
print(settings)
asyncio.run(main())
ptsandbox.sandbox.ui._system.SystemMixin.get_system_settings
async
Get information about the system settings
Returns:
-
SandboxSystemSettingsResponse–A model with system settings
Raises:
-
SandboxException–if not authorized or token refresh fails
-
ClientResponseError–if the server returns an error status
-
ClientError–on connection or transport errors
-
ValidationError–if the response body does not match the expected model
Update information
import asyncio
from ptsandbox import Sandbox, SandboxKey
from ptsandbox.models import SandboxUpdateSystemSettingsRequest
async def main():
sandbox = Sandbox(...)
await sandbox.ui.authorize()
await sandbox.ui.update_system_settings(
SandboxUpdateSystemSettingsRequest(
quarantine=SandboxUpdateSystemSettingsRequest.Quarantine(
retention_period=30000,
)
)
)
asyncio.run(main())
ptsandbox.sandbox.ui._system.SystemMixin.update_system_settings
async
Update system settings
Raises:
-
SandboxException–if not authorized or token refresh fails
-
ClientResponseError–if the server returns an error status
-
ClientError–on connection or transport errors
Version
import asyncio
from ptsandbox import Sandbox, SandboxKey
async def main():
sandbox = Sandbox(...)
await sandbox.ui.authorize()
version = await sandbox.ui.get_system_version()
print(version)
asyncio.run(main())
ptsandbox.sandbox.ui._system.SystemMixin.get_system_version
async
Get the version of the installed product
Raises:
-
SandboxException–if not authorized or token refresh fails
-
ClientResponseError–if the server returns an error status
-
ClientError–on connection or transport errors
-
ValidationError–if the response body does not match the expected model
System Logs
import aiofiles
import asyncio
from ptsandbox import Sandbox, SandboxKey
async def main():
sandbox = Sandbox(...)
await sandbox.ui.authorize()
async with aiofiles.open("logs.zip", "wb") as fd:
async for chunk in sandbox.ui.get_system_logs(): # (1)!
await fd.write(chunk)
asyncio.run(main())
Without parameters, all logs will be downloaded. This can be several gigabytes.
ptsandbox.sandbox.ui._system.SystemMixin.get_system_logs
async
get_system_logs(
since: int | None = None,
components: list[str] | None = None,
) -> AsyncIterator[bytes]
Download the archive with system logs
Parameters:
-
since(int | None, default:None) –the time period for uploading logs in seconds
-
components(list[str] | None, default:None) –component names in the format
{namespace}/{component},{namespace}/{component}, ... If the field is empty, all components will be downloaded
Returns:
-
AsyncIterator[bytes]–Archive with logs
Raises:
-
SandboxException–if not authorized or token refresh fails
-
ClientResponseError–if the server returns an error status
-
ClientError–on connection or transport errors
License
License management methods are documented on the License page.