Swimlane Python SDK
raw JSON → 10.19.1 verified Fri May 01 auth: no python
Official Python driver for the Swimlane SOAR API. Provides programmatic access to Swimlane instances for managing records, applications, alerts, and other entities. Current version 10.19.1, supports Python >=3.6, released irregularly with security and feature updates.
pip install swimlane Common errors
error AttributeError: module 'swimlane' has no attribute 'SwimlaneInstance' ↓
cause Installed an older version (<10.0.0) that used a different class name or structure.
fix
Upgrade to latest:
pip install --upgrade swimlane and verify import: from swimlane import SwimlaneInstance. error requests.exceptions.ConnectionError: HTTPSConnectionPool(host='...', port=443): Max retries exceeded with url ↓
cause Hostname is unreachable, possibly missing https:// or incorrect URL.
fix
Ensure hostname includes protocol:
'https://your-instance.swimlane.com' and no trailing slash. Check network/firewall. error swimlane.exceptions.AuthenticationError: Authentication failed ↓
cause Invalid username/password, or account locked.
fix
Verify credentials in environment variables. Ensure the user has API access enabled in Swimlane.
error TypeError: __init__() got an unexpected keyword argument 'api_key' ↓
cause Using `api_key` which was removed in v10.0.0.
fix
Use
username and password instead: SwimlaneInstance(hostname, username=..., password=...). Warnings
gotcha The library uses `requests` and may throw `requests.exceptions.ConnectionError` without clear messages if the hostname is unreachable or has SSL issues. Always verify `SWIMLANE_HOST` includes the protocol (https://) and no trailing slash. ↓
fix Ensure hostname is 'https://your-instance.swimlane.com' (including https://, no trailing slash).
breaking In v10.0+, the `SwimlaneInstance` no longer accepts `api_key` parameter for authentication; use `username` and `password` instead. API keys were removed. ↓
fix Replace `api_key='xyz'` with `username='user', password='pass'`.
deprecated Using `from swimlane import App` is deprecated since v10. Use `from swimlane.core.resources.app import App` or access via `sw.apps` methods. ↓
fix Use `app = sw.apps.get(id='...')` or list with `sw.apps.list()`.
gotcha Record field access may raise `KeyError` if field names contain spaces or special characters. Use `record['field_name']` always, not `record.field_name`, as attribute access may fail. ↓
fix Always use dictionary-style access: `value = my_record['Field Name']`.
Imports
- SwimlaneInstance wrong
from swimlane.app import SwimlaneInstancecorrectfrom swimlane import SwimlaneInstance - Record wrong
from swimlane.models import Recordcorrectfrom swimlane.core.resources.record import Record
Quickstart
from swimlane import SwimlaneInstance
import os
sw = SwimlaneInstance(
hostname=os.environ.get('SWIMLANE_HOST', ''),
username=os.environ.get('SWIMLANE_USER', ''),
password=os.environ.get('SWIMLANE_PASS', '')
)
# List applications
apps = sw.apps.list()
print(apps)