swimlane.core.client module¶
Core Swimlane client class
- class swimlane.core.client.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:
- users¶
UserAdapter
configured for current Swimlane instance- Type:
- groups¶
GroupAdapter
configured for current Swimlane instance- Type:
- resources_cache¶
Cache checked by all supported adapters for current Swimlane instance
- Type:
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:
Notes
All other provided kwargs are passed to underlying
requests.Session.request()
call- Raises:
swimlane.exceptions.SwimlaneHTTP400Error – On 400 responses with additional context about the exception
requests.HTTPError – Any other 4xx/5xx HTTP responses
- Returns:
Successful response instances
- Return type:
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>
- class swimlane.core.client.SwimlaneJwtAuth(swimlane, username, password)[source]¶
Bases:
SwimlaneResolver
Handles authentication for all requests
- class swimlane.core.client.SwimlaneTokenAuth(swimlane, access_token)[source]¶
Bases:
SwimlaneResolver
Handles token authentication for all requests
New in version 4.1.0.