swimlane package

Swimlane Python API driver

class swimlane.Swimlane(host, username=None, password=None, verify_ssl=True, default_timeout=60, verify_server_version=True, resource_cache_size=0, access_token=None, write_to_read_only=False)[source]

Bases: object

Swimlane API client

Core class used throughout library for all API requests and server interactions

Parameters:
  • host (str) – Full RFC-1738 URL pointing to Swimlane host. Defaults will be provided for all parts

  • username (str) – Authentication username

  • password (str) – Authentication password

  • verify_ssl (bool) – Verify SSL (ignored on HTTP). Disable to use self-signed certificates

  • default_timeout (int) – Default request connect and read timeout in seconds for all requests

  • verify_server_version (bool) – Verify server version has same major version as client package. May require additional requests, set False to disable check

  • resource_cache_size (int) – Maximum number of each resource type to keep in memory cache. Set 0 to disable caching. Disabled by default

  • access_token (str) – Authentication token, used in lieu of a username and password

  • write_to_read_only (bool) – Enable the ability to write to Read-only fields

host

Full RFC-1738 URL pointing to Swimlane host

Type:

pyuri.URI

apps

AppAdapter configured for current Swimlane instance

Type:

AppAdapter

users

UserAdapter configured for current Swimlane instance

Type:

UserAdapter

groups

GroupAdapter configured for current Swimlane instance

Type:

GroupAdapter

resources_cache

Cache checked by all supported adapters for current Swimlane instance

Type:

ResourcesCache

Examples

# Establish connection using username password
swimlane = Swimlane(
    'https://192.168.1.1',
    'username',
    'password',
    verify_ssl=False
)

# Or establish connection using personal access token
swimlane = Swimlane(
    'https://192.168.1.1',
    access_token='abcdefg',
    verify_ssl=False
)

# Retrieve an app
app = swimlane.apps.get(name='Target App')
property build_number

Swimlane build number

property build_version

Swimlane semantic build version

Falls back to product version in pre-2.18 releases

property product_version

Swimlane product version

request(method, api_endpoint, **kwargs)[source]

Wrapper for underlying requests.Session

Handles generating full API URL, session reuse and auth, request defaults, and invalid response status codes

Used throughout library as the core underlying request/response method for all interactions with server

Parameters:
  • method (str) – Request method (get, post, put, etc.)

  • api_endpoint (str) – Portion of URL matching API endpoint route as listed in platform /docs help page

  • **kwargs (dict) – Remaining arguments passed through to actual request call

Notes

All other provided kwargs are passed to underlying requests.Session.request() call

Raises:
Returns:

Successful response instances

Return type:

requests.Response

Examples

Request and parse server settings endpoint response

>>> server_settings = swimlane.request('get', 'settings').json()
property settings

Retrieve and cache settings from server

property user

User record instance for authenticated user

property version

Full Swimlane version, <product_version>+<build_version>+<build_number>

Subpackages

Submodules