List Active Sessions

Returns a list of all currently active sessions.

Python SDK

from marinabox import MarinaboxSDK

sdk = MarinaboxSDK()
sessions = sdk.list_sessions()  # Returns List[BrowserSession]

# Print session details
for session in sessions:
    print(f"Session ID: {session.session_id}")
    print(f"VNC Port: {session.vnc_port}")
    print(f"Status: {session.status}")

Response Objects

The method returns a list of BrowserSession objects, each containing:

{
    "session_id": "abc123xyz",
    "container_id": "abc123xyz789",
    "vnc_port": 5002,
    "created_at": "2024-12-14T10:30:00Z",
    "env_type": "browser",
    "debug_port": 4002,
    "status": "running",
    "runtime_seconds": 3600,
    "tag": "Development"
}

Error Handling

try:
    sessions = sdk.list_sessions()
except Exception as e:
    print(f"Failed to list sessions: {e}")

Get Support & Join Our Community