Ping Sandbox
Quickly check if a sandbox is responsive and healthy.
sandbox.ping() -> boolReturns
Returns True if the sandbox is responsive, False if unresponsive or unreachable.
Examples
Basic Example
from concave import Sandbox
sbx = Sandbox.create()
# Check if sandbox is alive
is_alive = sbx.ping()
if is_alive:
print("Sandbox is responsive!")
else:
print("Sandbox is not responding")
sbx.delete()Monitor Multiple Sandboxes
from concave import Sandbox
sandboxes = Sandbox.list()
for sbx in sandboxes:
if sbx.ping():
print(f"✓ {sbx.id} is healthy")
else:
print(f"✗ {sbx.id} is unhealthy")Exceptions
SandboxNotFoundErrorExceptionRaised when the sandbox no longer exists (404 status).
SandboxAuthenticationErrorExceptionRaised when authentication fails (401/403 status).
SandboxTimeoutErrorExceptionRaised when the ping request times out (5 second timeout).
Error Handling
from concave import (
Sandbox,
SandboxNotFoundError,
SandboxAuthenticationError
)
sbx = Sandbox.create()
try:
is_alive = sbx.ping()
print(f"Sandbox responsive: {is_alive}")
except SandboxNotFoundError:
print("Sandbox no longer exists")
except SandboxAuthenticationError:
print("Authentication failed")
finally:
sbx.delete()