swimlane python documentation

84
Swimlane Python Documentation Release 10.7.0 Swimlane Apr 12, 2022

Upload: others

Post on 02-May-2022

56 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Swimlane Python Documentation

Swimlane Python DocumentationRelease 10.7.0

Swimlane

Apr 12, 2022

Page 2: Swimlane Python Documentation
Page 3: Swimlane Python Documentation

Contents

1 Installation 31.1 Pip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2 Offline Installer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.3 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.4 Versioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2 Usage 52.1 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3 Package Docs 333.1 swimlane package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

Python Module Index 71

Index 73

i

Page 4: Swimlane Python Documentation

ii

Page 6: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

2 Contents

Page 7: Swimlane Python Documentation

CHAPTER 1

Installation

1.1 Pip

Recommended installation method is to install via pip.

Install/upgrade to latest release:

pip install -U swimlane

Install/upgrade to latest release for platform v2.x:

pip install -U "swimlane>=2,<3"

1.2 Offline Installer

An installer including bundled dependencies is made available for easy offline installs

Download and run .pyz self-extracting archive from Github releases page for the correct platform and python version:

wget https://github.com/swimlane/swimlane-python/releases/download/<release>/swimlane-→˓python-<version>-offline-installer-<platform>-<python>.pyzpython ./swimlane-python-<version>-offline-installer-<platform>-<python>.pyz

Note: Offline installer requires pip v9+, installation will fail when attempting to use an earlier version. Verify pipversion with pip -V.

1.3 Git

Manually clone from Github repository, checkout, and install specific branch or release:

3

Page 8: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

git clone https://github.com/swimlane/swimlane-pythoncd swimlane-pythongit checkout <branch>pip install .

Note: Installing via Git will install as a working version, and should only be used for driver development. Somefeatures like server/client version compatibility checking may not work as expected when not installing productionreleases.

1.4 Versioning

The Swimlane python driver is versioned along with the Swimlane product version, and will support all minorversions below installed version. The latest major release should always be installed matching the target server majorbuild version. Patch version is reserved for driver fixes, and is not related to Swimlane server version.

Newer minor server releases will typically work as expected, but could have minor inconsistencies or missing features.A warning message will be logged when connecting to a newer minor server release than the current driver release,but will otherwise work as expected.

Warning: Major versions of driver and server are incompatible, and will NOT work together and will raiseswimlane.exceptions.InvalidServerVersion when attempting to connect.

For example, swimlane==2.15.0 will fully support Swimlane versions 2.0 - 2.15, will warn and attempt to work whenconnecting to versions 2.16 - 2.x, and will fail when connecting to versions 3.0+.

4 Chapter 1. Installation

Page 9: Swimlane Python Documentation

CHAPTER 2

Usage

All connection and interaction with Swimlane API is handled via the swimlane.Swimlane client.

Connection, authentication, and any additional requests will all be handled by the client class automatically throughoutthe rest of the examples in the documentation.

2.1 Quick Start

from swimlane import Swimlane

# Connect Swimlane client outside of Swimlaneswimlane = Swimlane('https://192.168.1.1', 'username', 'password')

# Connect Swimlane client from Python task in Swimlaneswimlane = Swimlane(sw_context.config['InternalSwimlaneUrl'],'username','password')

# Retrieve App by nameapp = swimlane.apps.get(name='Target App')

# Create new Recordnew_record = app.records.create(**{

'Text Field': 'String','Numeric Field': 100,'UserGroup Field': swimlane.user,'ValuesList Field': ['Option 1', 'Option 2']

})

# Work with field valuesassert new_record['Text Field'] == 'String'

(continues on next page)

5

Page 10: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

(continued from previous page)

new_record['Numeric Field'] += 100assert new_record['Numeric Field'] == 200

assert new_record['UserGroup Field'].id == swimlane.user.id

2.2 Examples

Complete examples and descriptions of all driver functionality

2.2.1 Swimlane Client

See swimlane.core.client.Swimlane for full client API documentation.

Configuration

Minimal Setup

Bare-minimum values necessary to connect to a Swimlane server with default settings are the host, username, andpassword.

Authentication is performed immediately, client instantiation will fail immediately if invalid credentials are provided.

If no scheme is provided, HTTPS is used as the default.

from swimlane import Swimlane

swimlane = Swimlane('192.168.1.1', 'username', 'password')

A personal access token can also be used in place of a username and password.

from swimlane import Swimlane

swimlane = Swimlane('192.168.1.1', access_token='abcdefg')

Clear HTTP Connection

Connecting to Swimlane over plain HTTP is supported, but not recommended.

To connect using HTTP, provide it as part of the host URL.

from swimlane import Swimlane

swimlane = Swimlane('http://192.168.1.1', 'username', 'password')

Non-Standard Port

To connect to Swimlane over a non-standard port, include the port as part of the host URL

6 Chapter 2. Usage

Page 11: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

from swimlane import Swimlane

swimlane = Swimlane('https://192.168.1.1:8443','username','password',verify_ssl=False

)

SSL Verification

SSL certificate verification is enabled by default for all HTTPS connections. Client instantiation will fail if Swimlaneserver SSL certificate cannot be verified.

To disable SSL verification, set verify_ssl=False during client instantiation. This will be carried over to all additionalrequests made by using the client automatically.

Warning: Because it’s common to disable SSL verification, the normal urllib3.exceptions.InsecureRequestWarning is suppressed automatically when using the Swimlane client. See urllib3 docsfor more information.

from swimlane import Swimlane

swimlane = Swimlane('192.168.1.1','username','password',verify_ssl=False

)

The verify_ssl parameter is ignored when connecting over HTTP.

Resource Caching

New in version 2.16.2.

The Swimlane client supports automatic caching for most API resources. When enabled, requests for resource datawill first check the client’s cache for the requested resource, returning it without making an additional request if found.

To enable caching, set the resource_cache_size parameter when initializing the Swimlane client. The cache sizeapplies to each resource type individually, meaning a cache size of 20 would cause the client to cache up to 20 of eachof the following supported resource types at a time:

• App

• Record

• User

• Group

Once a cache is full, items are removed using “Least Frequently Used (LFU)” priority, meaning the resources that aremost often accessed will be kept in the cache longer than less-frequently accessed resources.

2.2. Examples 7

Page 12: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

# Enable basic logging to print requests and cache hits/missesimport logging; logging.basicConfig(level=logging.DEBUG)

from swimlane import Swimlane

# Enable caching up to 20 different instances of each supported resource typeswimlane = Swimlane(

'192.168.1.1','username','password',resource_cache_size=20

)

# Slow code making multiple requests for the same App, Record, and referenced Records→˓in a loop# With caching enabled, performance is much higher as requests are sent only for→˓resources not already in the cachefor _ in range(5):

app = swimlane.apps.get(id='abc...123')print(app)

record = app.records.get(id='def...456')print(record)

for reference_record in record['Reference Field']:print(reference_record)

Resource caching can provide a big performance boost when requesting the same resources multiple times, especiallywhen performing multiple searches or accessing references fields pointing to the same set of records.

Write to Read Only Fields

To enable the ability to set fields that have been marked Read-Only in the application builder, you can set thewrite_to_read_only parameter when initializing the Swimlane client.

from swimlane import Swimlane

swimlane = Swimlane('192.168.1.1','username','password',write_to_read_only=True)

app = swimlane.apps.get(id='abc...123')record = app.records.get(id='def...456')

record['Read-Only Field'] = "New Value"record.save()

Custom Direct Requests

Not all API endpoints may be currently supported by internal adapters, or custom arguments may be required in specialcases not handled by other resources.

8 Chapter 2. Usage

Page 13: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

To perform a custom request and handle the response directly, use the swimlane.Swimlane.request()method.

from swimlane import Swimlane

swimlane = Swimlane('192.168.1.1', 'username', 'password')

response = swimlane.request('post','some/endpoint',json={...},params={...},...

)

Underlying connection session will be reused, authentication will be handled automatically, and all default requestconfigurations will be applied as normal if not provided explicitly.

All provided keyword arguments will be passed to the underlying requests.Session.request() call.

Note: Any 400/500 responses will raise requests.HTTPError automatically.

Request Timeouts

Initial client connection and all request read timeouts are set to 60 seconds by default. For more information ontimeouts, refer to the Requests timeout documentation.

To override the default global timeout used by all library methods, provide the default_timeout parameter in secondsduring client instantiation.

from swimlane import Swimlane

swimlane = Swimlane('192.168.1.1','username','password',default_timeout=300

)

The swimlane.Swimlane.request() method can also accept an optional timeout parameter that will overridethe global default timeout for the single request.

from swimlane import Swimlane

swimlane = Swimlane('192.168.1.1', 'username', 'password')

# Potentially long delay before starting response with 10 minute timeoutresponse = swimlane.request(

'post','some/endpoint',...,timeout=600

)

2.2. Examples 9

Page 14: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

Server Version Verification

By default, client will check that the major versions of server and client match, and raise swimlane.exceptions.InvalidServerVersion if they do not.

This may require an additional request that may not otherwise be required to retrieve the server version, and and bedisabled by setting verify_server_version=False.

Note: Connecting to a newer major server version is not supported, and should not be expected to work as normal ifthis verification is disabled.

Only disable this verification when sure you are using the correct client library version.

from swimlane import Swimlane

swimlane = Swimlane('192.168.1.1','username','password',verify_server_version=False

)

Available Adapters

Examples of usage for preconfigured adapters available on client instances, abstracting retrieval and instantiation ofvarious resource instances.

See various adapter class documentation swimlane.core.adapters for more information

Apps

Handles retrieval of App resources.

Retrieve an app by ID or name:

app_by_id = swimlane.apps.get(id='58f...387')

app_by_name = swimlane.apps.get(name='Target App')

Get list of all apps:

apps = swimlane.apps.list()

Users

Handles retrieval of User resources.

Retrieve a single user by ID or display name:

user_by_id = swimlane.users.get(id='58f...387')

user_by_display_name = swimlane.users.get(display_name='admin')

10 Chapter 2. Usage

Page 15: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

Get list of all users:

users = swimlane.users.list()

Groups

Handles retrieval of Group resources.

Retrieve a single group by ID or name:

group_by_id = swimlane.groups.get(id='58f...387')

group_by_display_name = swimlane.groups.get(name='Everyone')

Get list of all groups:

groups = swimlane.groups.list()

Helpers

Any miscellaneous methods for API endpoints not better suited for other adapters or used for high performance withbulk requests.

swimlane.helpers.add_record_references(app_id='123...456',record_id='789...0ab',field_id='abc...def',target_record_ids=[

'123...456','789...0ab','cde...f12',...

])

Check the status of app.records.bulk_modify() or app.records.bulk_delete() jobs.

# Get target appapp = swimlane.apps.get(name='App')

# Bulk modify records matching filtersjob_id = app.records.bulk_modify(

('Numeric', 'equals', 1),values={'Numeric': 2}

)

# Check bulk job statusstatus = swimlane.helpers.check_bulk_job_status(job_id)print(status)

[{'$type': 'Core.Models.Jobs.JobInfo, Core','job': 'a4EDVRY7UOHpz5_xV','status': 'started','task': 'BatchRecordUpdate'},

(continues on next page)

2.2. Examples 11

Page 16: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

(continued from previous page)

{'$type': 'Core.Models.Jobs.JobInfo, Core','job': 'a4EDVRY7UOHpz5_xV','message': 'Batch update 100% completed.','status': 'inProgress','task': 'BatchRecordUpdate'},

{'$type': 'Core.Models.Jobs.JobInfo, Core','details': {'$type': 'Core.Models.Notifications.BulkModifyFinishedNotification, Core

→˓','applicationId': 'aRDyEl8ZRd7gKrEN5','bulkModificationType': 'update','dateTime': '2018-01-02T16:46:46.4982709Z','disabled': False,'errors': [],'id': 'aJxpdAwvKWUSaEPRz','jobId': 'a4EDVRY7UOHpz5_xV','notificationType': 'console','output': 'Task complete','status': 'Finished','taskName': 'BatchRecordUpdate','totalRecordsSkipped': 1,'totalRecordsUpdated': 0,'userName': 'admin','warnings': [{'$type': 'Core.Models.Notifications.RecordMessage, Core',

'message': 'Record is already locked, skipping','recordId': 'aPieydMqIo6lgwxd9','trackingId': 'BNAW-15'}]},

'job': 'a4EDVRY7UOHpz5_xV','status': 'completed','task': 'BatchRecordUpdate'}]

2.2.2 Resources

See swimlane.core.resources for full API docs on all resources

App

App instances represent apps available on Swimlane server, and provide methods to retrieve and create child Records

Retrieve apps using the apps adapter available on the swimlane.Swimlane client

Retrieve Records

Records can be retrieved by tracking ID or record ID. Only records in the source app are returned, IDs matchingrecords from other apps will fail to be retrieved.

app = swimlane.apps.get(name='Target App')

# Get by Tracking IDrecord_from_tracking = app.records.get(tracking_id='APP-1')# Get by Record IDrecord_from_id = app.records.get(id='58f...387')

assert record_from_tracking == record_from_id

12 Chapter 2. Usage

Page 17: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

Search Records

Searching is done using the app.records adapter, and uses temporary Report instances to handle paginatedsearch results and record retrieval on-demand.

Filters can be applied using tuples of (<field_name>, <filter_operator>, <field_value>) that will be AND’ed togetheron the report.

records = app.records.search(('Text Field', 'equals', 'value'),('Date Field', 'lessThan', pendulum.now()),('Values List (Multi-Select)', 'equals', ['Option 1', 'Option 2'])('Reference (Single-Select)', 'equals', target_record)

)

Keyword-searches can be performed by providing a keywords list parameter. All records with fields matching theprovided keywords will be returned

records = app.records.search(keywords=[

'target','keywords'

])

Available operators are just strings as shown above, but are made available as constants in the search module

from swimlane.core.search import EQ, NOT_EQ, CONTAINS, EXCLUDES, GT, LT, GTE, LTE

records = app.records.search(('Text Field', EQ, 'equal value'),('Number Field', GTE, 0),

)

Warning: Report results are retrieved during on-demand during iteration, requesting record data from the APIbefore each loop to improve performance and reduce memory footprint.

Using app.records.search loads all records into a list before returning, which can be an expensive operation,especially with many results.

A default limit of 50 records is placed on all reports for performance, use the limit parameter to override thedefault limit on a search, a limit of 0 retrieves all search results.

# retrieve all resultsrecords = app.records.search(

('Text Field', 'equals', 'value'),...limit=0

)

Reports

To operate on large search results as records are returned from API or retrieve only partial results Report should beused instead.

2.2. Examples 13

Page 18: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

# Create initial report, with optional limit and keywords filterreport = app.reports.build('report-name', limit=0, keywords=['target', 'keywords'])

# Apply report filters# These work like search filters, but must be applied one-by-one and are NOT tuples→˓like in app.records.search()report.filter('Text Field', 'equals', 'value')report.filter('Numeric Field', 'equals', 0)

# Each record is retrieved from the API on-demand before each iterationfor record in report:

# Do something with each retrieved recordrecord['Test Field'] = 'modified'

if some_condition:# No additional records will be retrieved from report after breaking out of

→˓loopbreak

# Report results are cached after first iteration, will not make additional requests→˓or retrieve any skipped results# Any modifications to records from report are maintainedfor record in report:

assert record['Test Field'] == 'modified'

Create New Record

Record creation is done through the app.records adapter, and adheres to all field validation as documented below.Any values in Selection Fields that are configured to be selected by default will be added to your new record. You canoverride the default selection by specifying the value wanted on creation.

The newly created record is returned from the create create call after first being persisted on the server

new_record = app.records.create(**{'Text Field': 'Field Value','Numeric Field': 50,...

})

Bulk Record Create

Creating multiple records at once can also done withe the app.records adapter using only a single request.

Any records not passing validation will cause the entire operation to fail.

records = app.records.bulk_create({'Text Field': 'Value 1', 'Numeric Field': 10, ...},{'Text Field': 'Value 2', 'Numeric Field': 20, ...},...

)

Note: Changed in version 2.17.0: Method was renamed from create_batch() -> bulk_create()

14 Chapter 2. Usage

Page 19: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

create_batch() will be removed in next major release.

Bulk Record Delete

Delete multiple records at once.

# Delete by recordrecord1 = app.records.get(tracking_id='APP-1')record2 = app.records.get(tracking_id='APP-2')record3 = app.records.get(tracking_id='APP-3')

app.records.bulk_delete(record1, record2, record3)

Delete multiple records at once by filters using filter format from search.

# Delete by filterrecords = app.records.bulk_delete(

('Field_1', 'equals', value1),('Field_2', 'equals', value2)

)

Bulk Record Modify

Bulk modify fields records by list of Record instances.

Invalid field values will cause entire operation to fail.

# Bulk modify multiple record instancesrecord1 = app.records.get(tracking_id='APP-1')record2 = app.records.get(tracking_id='APP-2')record3 = app.records.get(tracking_id='APP-3')...

app.records.bulk_modify(record1,record2,record3,...values={

'Field Name': 'New Value',...

})

Bulk modify records by filter tuples without record instances.

# Modify by filter(s)app.records.bulk_modify(

# Query filters("Text Field", "equals", "Value"),("Number Field", "equals", 2),# New values for recordsvalues={

"Field Name": "New Value",

(continues on next page)

2.2. Examples 15

Page 20: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

(continued from previous page)

"Numeric Field": 10,...

})

Use bulk modify to append, remove, or clear list field values

from swimlane.core.bulk import Clear, Append, Remove

app.records.bulk_modify(('Text List', 'equals', ['some', 'value']),('Numeric List', 'equals', [1, 2, 3, 4]),values={

'Text List': Remove('value'),'Field Name': Clear(),'Numeric List': Append(5)

})

Retrieve App Revisions

Retrieve historical revisions of the application.

# get all revisionsapp_revisions = app.revisions.get_all()

# get by revision numberapp_revision = app.revisions.get(2)

# get the historical version of the apphistorical_app_version = app_revision.version

Record

Record instances represent individual records inside a corresponding app on Swimlane server.

They provide the ability to interact with field data similar to how it’s done in the Swimlane UI, and handle translatingand validating field types using various Field classes under the hood.

Accessing Field Values

Fields are accessed as keys by their readable field names as seen in the UI. Field names are case and whitespacesensitive, and are unique within an individual app.

Assuming a record from an app with a text field called “Text” with a value of “Some Example Text”, accessing thefield value is done as follows:

# The "Text" field has a value of 'Some Example Text'assert record['Text'] == 'Some Example Text'

# Any fields without a value default to `None`.assert record['Empty Field'] == None

16 Chapter 2. Usage

Page 21: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

Field can also be accessed by their optional field keys

# The field key points to the same field as the field nameassert record['Field'] == record['field-key']

Setting Field Values

Setting field values works the same as accessing values.

record['Text'] = 'New Text'

assert record['Text'] == 'New Text'

Clearing Field Values

Clearing field values can be done in one of two way. The following examples are identical, and simply clear the fieldvalue, setting it back to None internally.

# Delete the fielddel record['Text']

# Or set directly to Nonerecord['Text'] = None

Field Validation

Most field types enforce a certain type during the set operation, and will raise a swimlane.exceptions.ValidationError on any kind of failure, whether it’s an invalid value, incorrect type, etc. and will containinformation about why it was unable to validate the new value.

try:record['Numeric'] = 'String'

except ValidationError as error:print(error)

See individual field examples for more specifics on each field type and their usage.

Saving Changes

All changes to a record are only done locally until explicitly persisted to the server with save().

record['Text'] = 'Some New Text'record.save()

Delete Record

Records can be deleted from Swimlane using delete(). Record will be removed from server and marked as a newrecord, but will retain any field data.

2.2. Examples 17

Page 22: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

assert record.tracking_id == 'ABC-123'text_field_data = record['Text']

# Deletes existing record from serverrecord.delete()

assert record.id is Noneassert record['Text'] == text_field_data

...

# Create a new record from the deleted record's field datarecord.save()

assert record.tracking_id == 'ABC-124'

Field Iteration

Records can be iterated over like dict.items(), yielding (field_name, field_value) tuples

for field_name, field_value in record:assert record[field_name] == field_value

Lock Record

Record locks can be modified using lock() and unlock() methods. The record is locked to the user making theAPI call.

# Lock the recordrecord.lock()

# Unlock the recordrecord.unlock()

Pretty Iteration + JSON Serialization

New in version 4.1.0.

Some field types are not cleanly printed or cannot be easily serialized to JSON. A record can be converted to a prettierJSON-safe dict using the for_json() method.

import json

# Quick serialize all fields on record to readable JSON-compatible format dictprint(json.dumps(

record.for_json(),indent=4

))

# Specify subset of fields to include in output dictprint(json.dumps(

record.for_json('Target Field 1', 'Target Field 2', ...),

(continues on next page)

18 Chapter 2. Usage

Page 23: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

(continued from previous page)

indent=4))

# Get a single field's JSON-compatible valueprint(json.dumps(

record.get_field('Target Field').for_json()))

# Attachments, Comments, UserGroups, and any Cursors can all be converted to JSON-→˓compatible values directlyprint(json.dumps(

record['User Group Field'].for_json()))print(json.dumps(

record['Comments Field'][2].for_json()))

Unknown Fields

Attempting to access a field not available on a record’s parent app will raise swimlane.exceptions.UnknownField with the invalid field name, as well as potential similar field names in case of a possible typo.

try:record['Rext'] = 'New Text'

except UnknownField as error:print(error)

Restrict Record

Record restrictions can be modified using add_restriction() and remove_restriction() methods.

# Add user(s) to set of users allowed to modify recordrecord.add_restriction(swimlane.user, other_user)

# Remove one or more users from restriction setrecord.remove_restriction(swimlane.user)

# Clear the entire restricted user setrecord.remove_restriction()

Retrieve Record Revisions

Retrieve historical revisions of the record.

# get all revisionsrecord_revisions = record.revisions.get_all()

# get by revision numberrecord_revision = record.revisions.get(2)

# get the historical version of the app

(continues on next page)

2.2. Examples 19

Page 24: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

(continued from previous page)

# automatically retrieves the corresponding app revision to create the Record objecthistorical_record_version = record_revision.version

UserGroup

Handling Users, Groups, and UserGroups

The User and Group classes both extend from the base UserGroup class. Most values returned from the serverare of the base UserGroup type, but can be replaced or set by the more specific classes.

# User / Group fields return UserGroup instances when accessedassert type(record['Created By']) is UserGroup

# But can be set to the more specific User / Group types directlyrecord['User'] = swimlane.userrecord['Group'] = swimlane.groups.get(name='Everyone')

Resolve UserGroups

The base UserGroup instances can be easily resolved into the more specific User or Group instances when nec-essary using the resolve() method. This method is not called automatically to avoid additional requests where thebase UserGroup is sufficient.

# Resolve to actual User instanceassert type(record['User']) is UserGroupuser = record['User'].resolve()assert type(user) is User

# Resolve to actual Group instanceassert type(record['Group']) is UserGroupgroup = record['Group'].resolve()assert type(group) is Group

# Calling .resolve() on already resolved instances returns the same instance→˓immediatelyassert user is user.resolve()assert group is group.resolve()

Comparisons

Users and Groups and be directly compared to the base UserGroup class, and will be considered equal if the twoobjects represent the same entity

assert record['Created By'] == swimlane.user

assert record['Group'] == swimlane.groups.get(name='Everyone')

Users in Groups

To iterate over individual users in a group, use group.users property

20 Chapter 2. Usage

Page 25: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

group = swimlane.groups.get(name='Everyone')for user in group.users:

assert isinstance(user, User)

Revisions

Revisions represent historical versions of another resource. Currently, App and Record revisions are supported. Formore details on how to retrieve revisions, see the “Retrieve App Revisions” and “Retrieve Record Revisions” sectionsabove.

Get Information About the Revision

revision = app.revisions.get(1)

revision.modified_date # The date this revision was created.revision.revision_number # The revision number of this revision.revision.status # Indicates whether this revision is the current revision or a→˓historical revision.revision.user # The user that saved this revision.

app = revision.version # returns an App or Record object representing the revision→˓depending on revision type.

# additional functionstext = str(revision) # returns name of the revision and the revision number as a→˓stringjson = revision.for_json # returns a dict containing modifiedDate, revisionNumber,→˓and user keys/attribute values

Record Revisions

Record revisions additionally have attributes containing information about their app.

revision = record.revisions.get(1)

revision.app_revision_number # The app revision number this record revision was→˓created using.

app = revision.app_version # Returns an App corresponding to the app_revision_number→˓of this record revision.

2.2.3 Fields

Driver supports all field types available in Swimlane platform with automatic validation and coercion to best Pythonrepresentations of field values.

TrackingIdField

The “Tracking Id” field is always readonly, and exists on all records from all apps

2.2. Examples 21

Page 26: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

assert record['Tracking Id'] == 'RA-7'

try:record['Tracking Id'] = 'New Tracking ID'

except ValidationError:assert record['Tracking Id'] == 'RA-7'

TextField

Supports automatic str type coercion for non-string types

Assume the example below has a record with a text field “Severity” with the value “7”:

# Coerce to int, add, and automatically set back to str type in fieldassert record['Severity'] == '7'

# Update value, setting the text field to an intrecord['Severity'] = int(record['Severity']) + 1

# Value has been coerced to a stringassert isinstance(record['Severity'], str)assert record['Severity'] == '8'

NumericField

Number type enforcement validation. Supports any subclass of numbers.Number

assert isinstance(record['Numeric'], numbers.Number)

try:record['Numeric'] = 'Not a Number'

except ValidationError:record['Numeric'] = 5

assert record['Numeric'] == 5

DatetimeField

Full support for all valid Swimlane datetime subtypes:

• Date & Time

• Date

• Time

• Timespan

All datetime values throughout driver are returned as Pendulum objects.

Fields can be set to appropriate datetime types or respective Pendulum instances, and will always be convertedto corresponding Pendulum type matching the field subtype.

Datetime subtypes (not including Timespan) can be set to full datetime instances, and any extraneous information willbe discarded.

22 Chapter 2. Usage

Page 27: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

Timezone support is automatic, and can mostly be ignored when using Pendulum instances. All instances returnedfrom server are set to UTC.

Date & Time

Full specific date & time field

Returns pendulum.DateTime instances

datetime_field_value = record['Datetime']

# Drop-in replacement and extension of Python's builtin datetimeassert isinstance(datetime_field_value, datetime.datetime)assert isinstance(datetime_field_value, pendulum.Pendulum)

assert datetime_field_value.year == 2017assert datetime_field_value.month == 4assert datetime_field_value.day == 10assert datetime_field_value.hour == 16

# Set to a datetime/pendulum instance# See warning belowrecord['Datetime'] = now = pendulum.now().replace(microseconds=0)

# Fail on generic timestamp/string (not enough context to guarantee consistent→˓behavior)try:

record['Datetime'] = '2017-05-11 11:10:09'except ValidationError:

pass

assert record['Datetime'] == now

Warning: Mongo only supports millisecond resolution, datetimes returned from Swimlane API lose nanosecondresolution, leading to potentially slightly inconsistent datetimes before and after saving a record.

For consistency, nanoseconds are automatically stripped from datetimes when the field is set to a datetime withnanosecond precision.

Field equality comparisons with pendulum.now() or other datetime instances with nanosecond resolution will notbe accurate unless the nanoseconds are manually removed from the compared datetime.

# 2017-09-20 12:34:56.987654now = pendulum.now()

# 2017-09-20 12:34:56.987000record['Datetime'] = now

assert record['Datetime'] != now

For guaranteed equality checks, simplest solution is to remove the microsecond component entirely when settingthe field value in cases where sub-second resolution isn’t important.

# 2017-09-20 12:34:56.000000now = pendulum.now().replace(microsecond=0)

# 2017-09-20 12:34:56.000000record['Datetime'] = now

assert record['Datetime'] == now

2.2. Examples 23

Page 28: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

Manual rounding or less/greater than comparisons are necessary in cases where millisecond resolution is necessary

## Rounding comparison

# 2017-09-20 12:34:56.987654now = pendulum.now()

# 2017-09-20 12:34:56.987000record['Datetime'] = now

# 2017-09-20 12:34:56.987000rounded_now = now.replace(

microsecond=math.floor(now.microsecond / 1000) * 1000)

assert record['Datetime'] == rounded_now

## Proximity comparison

# 0.000654assert abs((record['Datetime'] - now).total_seconds()) < 0.001

Date

Date of year with no time component (2017-06-01).

Returns pendulum.Date instances

date_field = record['Date']assert isinstance(date_field, datetime.date)assert isinstance(date_field, pendulum.Date)

# Set to full datetime, time portion is dropped and Date instance is always returnedrecord['Date'] = pendulum.now()assert isinstance(record['Date'], pendulum.Date)

# Set to just daterecord['Date'] = pendulum.now().date()assert isinstance(record['Date'], pendulum.Date)

Time

Time of day with no date component (12:34:56).

Returns pendulum.Time instances

time_field = record['Time']assert isinstance(time_field, datetime.time)assert isinstance(time_field, pendulum.Time)

# Set to full datetime, date portion is dropped and Time instance is always returnedrecord['Time'] = pendulum.now()assert isinstance(record['Time'], pendulum.Time)

(continues on next page)

24 Chapter 2. Usage

Page 29: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

(continued from previous page)

# Set to just timerecord['Time'] = pendulum.now().time()assert isinstance(record['Time'], pendulum.Time)

Warning: Time instances do not respect timezone information, and should always be provided in UTC.

Recommend using full Pendulum datetime instances when working with Time fields. When using full datetimes,the timezone is respected before dropping the date portion.

Timespan

Time period (2 hours, 4 minutes, 15 seconds).

Returns pendulum.Duration instances

timespan_field = record['Timespan']assert isinstance(timespan_field, datetime.timedelta)assert isinstance(timespan_field, pendulum.Duration)

Note: Only subtype that cannot handle datetime/Pendulum instances. Must use datetime.timedelta or pendu-lum.Duration instances instead.

ValuesListField

Enforces valid selection options available in UI.

Single Select

Single-select mode values are accessed and set directly

# Valid option enforcementrecord['Status'] = 'Open'

try:record['Status'] = 'Not a valid option'

except ValidationError:record['Status'] = 'Closed'

assert record['Status'] == 'Closed'

Multi Select

Uses a cursor that behaves similar to a standard list to provide selection functionality and value enforcement.

2.2. Examples 25

Page 30: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

# Uses cursor for multi-select support with support for select, deselect, iteration,→˓etc.vl_cursor = record['Values List']assert len(vl_cursor) == 2

# Adding the same value multiple times is ignoredvl_cursor.select('Option 3')assert len(vl_cursor) == 3vl_cursor.select('Option 3')assert len(vl_cursor) == 3

# Remove element raises exception if not already addedvl_cursor.deselect('Option 3')assert len(vl_cursor) == 2

try:vl_cursor.deselect('Option 3')

except KeyError:assert len(vl_cursor) == 2

# Respects field's valid options and types, raising ValidationError for invalid valuestry:

vl_cursor.select('Not a valid option')except ValidationError:

assert len(vl_cursor) == 2

Field can be set directly to any iterable, overwriting current selection entirely

vl_original_values = list(record['Values List'])

record['Values List'] = []assert len(record['Values List']) == 0

# All elements must pass validation, or entire set operation failstry:

record['Values List'] = ['Option 1', 'Not a valid option']except ValidationError:

assert len(record['Values List']) == 0

record['Values List'] = vl_original_valuesassert len(record['Values List']) == 2

ListField

Text and numeric list field. Uses a TextListFieldCursor or a NumericListFieldCursor depending on thefield type to enforce min/max item count restrictions, min/max character/word limits, and numeric range restrictions.

Cursor works exactly like a normal primitive Python list with added validation around any methods modifying thelist or its items, and when overriding the field value entirely.

# Cursor behaving like a listtext_list_cursor = record['Text List Field']

# Iterationfor value in text_list_cursor:

print(value)

(continues on next page)

26 Chapter 2. Usage

Page 31: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

(continued from previous page)

# Modificationtext_list_cursor.reverse()text_list_cursor.insert(0, 'new value')

# Index/sliceassert text_list_cursor[0] == 'new value'

# Containsassert 'new value' in text_list_cursor

# Type validation# Failing validation will not modify the field valueoriginal_values = list(text_list_cursor)try:

text_list_cursor.append(123)except ValidationError:

assert len(original_values) == len(text_list_cursor)

# Replacement# Can be set directly to a new list of valuesrecord['Text List Field'] = ['new', 'values']

# Any invalid values will abort the entire operationtry:

record['Text List Field'] = ['text', 456]except ValidationError:

assert list(record['Text List Field']) == ['new', 'values']

UserGroupField

Returns UserGroup instances (current API limitation)

usergroup = record['Group']

assert isinstance(usergroup, UserGroup)assert usergroup.id == '58de1d1c07637a0264c0ca71'assert usergroup.name == 'Everyone'

# UserGroup comparisons with specific User/Group instancesassert usergroup == swimlane.groups.get(name='Everyone')

Set User, Group, or UserGroup

assert isinstance(swimlane.user, User)

record['User'] = swimlane.user

assert record['User'] == swimlane.user

Value must be a UserGroup instance or extension; Usernames, IDs, display names, etc. are all ambiguous

record['UserGroup'] = swimlane.user

try:(continues on next page)

2.2. Examples 27

Page 32: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

(continued from previous page)

record['UserGroup'] = 'Everyone'except ValidationError:

# Will not work, string is ambiguous and not a valid valuepass

assert record['UserGroup'] == swimlane.user

Note: Field support both single-select and multi-select modes like values lists.

Uses similar cursor as values list for multi-select, works exactly the same but for UserGroup objects instead of strings.

AttachmentsField

Returns a cursor managing iteration existing attachments.

attachments = record['Attachment']assert isinstance(attachments, AttachmentCursor)

for attachment in attachments:# Yields Attachment instancesassert isinstance(attachment, Attachment)assert attachment.filename == '5f09afe50064b2bd718e77818b565df1.pcap'assert attachment.file_id == '58ebb22907637a0b488b7b17'assert isinstance(attachment.upload_date, datetime)

# Retrieve file bytes as BytesIO stream (file-like object)stream = attachment.download()assert isinstance(stream, BytesIO)content = stream.read()assert len(content) > 0

Upload new attachment with a given filename and a file-like object

# Read file from disk and add as new attachmentwith open('/path/to/file', 'rb') as file_handle:

record['Attachment'].add('filename.txt', file_handle)

# Create new attachment from data already loaded into a file-like object# Useful when attaching data already read from disk or when that file data is used→˓multiple timesfrom io import BytesIO

with open('/path/to/file', 'rb') as file_handle:data = file_handle.read()

record['Attachment'].add('filename.txt', BytesIO(data))

Example showing adding a request response body as an attachment

from io import BytesIOimport requests

response = requests.get('http://httpbin.org/json')

(continues on next page)

28 Chapter 2. Usage

Page 33: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

(continued from previous page)

record['Attachment'].add('example.json', BytesIO(response.content))record.save()

Note: Attachment is uploaded, and associated with record locally, immediately.

Association with attachment on server is not persisted until calling record.save().

Clear all attachments

assert len(record['Attachment']) == 1

del record['Attachment']assert len(record['Attachment']) == 0

# Not cleared on server until savedrecord.save()

ReferenceField

Returns ReferenceCursor with lazy retrieval of target app definition and referenced records as accessed.

Yields (and caches) Record instances when iterated over.

Note: Orphaned referenced records (records deleted but referenced not yet removed) are ignored, and automaticallyremoved during iteration.

Saving a record after iterating over a reference field will remove those orphaned references on the server.

reference = record['Reference']assert isinstance(reference, ReferenceCursor)

assert len(reference) == 3

for referenced_record in reference:assert isinstance(referenced_record, Record)assert referenced_record._app != appassert referenced_record._app == reference.target_app

Add or remove references to Records

other_app = swimlane.apps.get(name='Reference App')ref_target_record = other_app.records.get(id='58e24e8607637a0b488849d4')

# Records added multiple times are ignoredrecord['Reference'].add(ref_target_record)assert len(record['Reference']) == 4

record['Reference'].add(ref_target_record)assert len(record['Reference']) == 4

# Remove reference. Raises exception if not already referencedrecord['Reference'].remove(ref_target_record)assert len(record['Reference']) == 3

2.2. Examples 29

Page 34: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

Target app validation

# Cannot reference a record from an app that is not the reference field's target apptry:

record['Reference'].add(record)except ValidationError:

assert len(record['Reference']) == 3

Override all references

# Can be set to a list of records directly# Acts similar to values list, any invalid records cause the entire operation to failrecord['Reference'] = [ref_target_record]assert len(record['Reference']) == 1

try:record['Reference'] = [ref_id, ref_target_record]

except ValidationError:assert len(record['Reference']) == 1

CommentsField

Cursor managing iteration and addition of comments

comments = record['Comments']assert isinstance(comments, CommentCursor)assert len(comments) == 1

for comment in comments:# Yields Comment instancesassert isinstance(comment, Comment)assert isinstance(comment.message, str)assert isinstance(comment.user, UserGroup)assert isinstance(comment.created_date, datetime)assert isinstance(comment.is_rich_text, boolean)

# Add new commentcomments.comment('New comment message')

# Add new rich text commentcomments.comment('<p>New Comment</p>', rich_text=True)

# Not persisted until saved, but still listed on local recordassert len(comments) == 2assert comments[1].message == str(comments[1]) == 'New comment message'

Note: Like attachments, comments are associated with a record only locally until calling record.save().

HistoryField

Returns a readonly RevisionCursor object that abstracts out retrieval of record history.

Each item in the RevisionCursor is a RecordRevision object, which performs additional requests to history API end-points as accessed. See the “Resources” section of the documentation for more information about the RecordRevision

30 Chapter 2. Usage

Page 35: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

object.

history = record['History']assert isinstance(history, RevisionCursor)

# Get number of revisionsnum_revisions = len(history)

# Iterate backwards over revisionsfor idx, revision in enumerate(history):

assert isinstance(revision, Revision)assert isinstance(revision.modified_date, datetime)assert isinstance(revision.user, UserGroup)assert num_revisions - revision.revision_number == idx

# revision.version is a full Record instance, and fields can be accessed like a→˓normal Record

assert revision.version.id == record.id

2.2. Examples 31

Page 36: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

32 Chapter 2. Usage

Page 37: Swimlane Python Documentation

CHAPTER 3

Package Docs

Full API documentation for all package components

3.1 swimlane package

Swimlane Python API driver

class swimlane.Swimlane(host, username=None, password=None, verify_ssl=True, de-fault_timeout=60, verify_server_version=True, resource_cache_size=0,access_token=None, write_to_read_only=False)

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 providedfor all parts

• username (str) – Authentication username

• password (str) – Authentication password

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

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

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

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

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

33

Page 38: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

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

hostFull RFC-1738 URL pointing to Swimlane host

Type pyuri.URI

appsAppAdapter configured for current Swimlane instance

Type AppAdapter

usersUserAdapter configured for current Swimlane instance

Type UserAdapter

groupsGroupAdapter configured for current Swimlane instance

Type GroupAdapter

resources_cacheCache checked by all supported adapters for current Swimlane instance

Type ResourcesCache

Examples

# Establish connection using username passwordswimlane = Swimlane(

'https://192.168.1.1','username','password',verify_ssl=False

)

# Or establish connection using personal access tokenswimlane = Swimlane(

'https://192.168.1.1',access_token='abcdefg',verify_ssl=False

)

# Retrieve an appapp = swimlane.apps.get(name='Target App')

build_numberSwimlane build number

build_versionSwimlane semantic build version

Falls back to product version in pre-2.18 releases

product_versionSwimlane product version

request(method, api_endpoint, **kwargs)Wrapper for underlying requests.Session

34 Chapter 3. Package Docs

Page 39: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

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

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 plat-form /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

• swimlane.exceptions.SwimlaneHTTP400Error – On 400 responses with ad-ditional context about the exception

• requests.HTTPError – Any other 4xx/5xx HTTP responses

Returns Successful response instances

Return type requests.Response

Examples

Request and parse server settings endpoint response

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

settingsRetrieve and cache settings from server

userUser record instance for authenticated user

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

3.1.1 Subpackages

swimlane.core package

Subpackages

swimlane.core.adapters package

Contains various adapters encapsulating API logic for retrieving, searching, listing, or creating resource objects

3.1. swimlane package 35

Page 40: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

Submodules

swimlane.core.adapters.app module

class swimlane.core.adapters.app.AppAdapter(swimlane)Bases: swimlane.core.resolver.SwimlaneResolver

Handles retrieval of Swimlane App resources

get(**kwargs)Get single app by one of id or name

Supports resource cache

Keyword Arguments

• id (str) – Full app id

• name (str) – App name

Returns Corresponding App resource instance

Return type App

Raises

• TypeError – No or multiple keyword arguments provided

• ValueError – No matching app found on server

list()Retrieve list of all apps

Returns List of all retrieved apps

Return type list of App

swimlane.core.adapters.app_revision module

class swimlane.core.adapters.app_revision.AppRevisionAdapter(app)Bases: swimlane.core.resolver.AppResolver

Handles retrieval of Swimlane App Revision resources

get(revision_number)Gets a specific app revision.

Supports resource cache

Keyword Arguments revision_number (float) – App revision number

Returns The AppRevision for the given revision number.

Return type AppRevision

get_all()Gets all app revisions.

Returns Returns all AppRevisions for this Adapter’s app.

Return type AppRevision[]

36 Chapter 3. Package Docs

Page 41: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

swimlane.core.adapters.helper module

class swimlane.core.adapters.helper.HelperAdapter(swimlane)Bases: swimlane.core.resolver.SwimlaneResolver

Adapter providing any miscellaneous API calls not better suited for another adapter

add_comment(app_id, record_id, field_id, message, rich_text=False)Directly add a comment to a record without retrieving the app or record first

Warning: Does not perform any app, record, or field ID validation

Parameters

• app_id (str) – Full App ID string

• record_id (str) – Full parent Record ID string

• field_id (str) – Full field ID to target reference field on parent Record string

• message (str) – New comment message body

• rich_text (bool) – Declare the message as being rich text, default is False

add_record_references(*args, **kwargs)Bulk operation to directly add record references without making any additional requests

Warning: Does not perform any app, record, or target app/record validation

Parameters

• app_id (str) – Full App ID string

• record_id (str) – Full parent Record ID string

• field_id (str) – Full field ID to target reference field on parent Record string

• target_record_ids (List(str)) – List of full target reference Record ID strings

check_bulk_job_status(job_id)Check status of bulk_delete or bulk_modify jobs .. versionadded:: 2.17.0 :param job_id: Job ID :typejob_id: str

Returns List of dictionaries containing job history

Return type list of dict

swimlane.core.adapters.record module

class swimlane.core.adapters.record.RecordAdapter(app)Bases: swimlane.core.resolver.AppResolver

Handles retrieval and creation of Swimlane Record resources

bulk_create(*args, **kwargs)Create and validate multiple records in associated app

Parameters *records (dict) – One or more dicts of new record field names and values

3.1. swimlane package 37

Page 42: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

Notes

Requires Swimlane 2.15+

Validates like create(), but only sends a single request to create all provided fields, and does not returnthe newly created records

Any validation failures on any of the records will abort the batch creation, not creating any new records

Does not return the newly created records

Examples

Create 3 new records with single request

app.records.bulk_create({'Field 1': 'value 1', ...},{'Field 1': 'value 2', ...},{'Field 1': 'value 3', ...}

)

Raises

• swimlane.exceptions.UnknownField – If any field in any new record cannot befound

• swimlane.exceptions.ValidationError – If any field in any new record failsvalidation

• TypeError – If no dict of fields was provided, or any provided argument is not a dict

bulk_delete(*args, **kwargs)Shortcut to bulk delete records

New in version 2.17.0.

Parameters *filters_or_records (tuple) or (Record) – Either a list of Records,or a list of filters.

Notes

Requires Swimlane 2.17+

Examples

# Bulk delete records by filterapp.records.bulk_delete(

('Field_1', 'equals', value1),('Field_2', 'equals', value2)

)

# Bulk delete by record instancesrecord1 = app.records.get(tracking_id='APP-1')record2 = app.records.get(tracking_id='APP-2')record3 = app.records.get(tracking_id='APP-3')app.records.bulk_delete(record1, record2, record3)

38 Chapter 3. Package Docs

Page 43: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

Returns Bulk Modify Job ID

Return type string

bulk_modify(*args, **kwargs)Shortcut to bulk modify records

New in version 2.17.0.

Parameters *filters_or_records (tuple) or (Record) – Either a list of Records,or a list of filters.

Keyword Arguments values (dict) – Dictionary of one or more ‘field_name’: ‘new_value’pairs to update

Notes

Requires Swimlane 2.17+

Examples

# Bulk update records by filter

app.records.bulk_modify(# Query filters('Field_1', 'equals', value1),('Field_2', 'equals', value2),...# New values for recordsvalues={

"Field_3": value3,"Field_4": value4,...

})

# Bulk update records

record1 = app.records.get(tracking_id='APP-1')record2 = app.records.get(tracking_id='APP-2')record3 = app.records.get(tracking_id='APP-3')

app.records.bulk_modify(record1, record2, record3, values={"Field_Name": 'new→˓value'})

Returns Bulk Modify Job ID

Return type string

create(**fields)Create and return a new record in associated app and return the newly created Record instance

Parameters **fields – Field names and values to be validated and sent to server with createrequest

3.1. swimlane package 39

Page 44: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

Notes

Keyword arguments should be field names with their respective python values

Field values are validated before sending create request to server

Examples

Create a new record on an app with simple field names

record = app.records.create(field_a='Some Value',someOtherField=100,...

)

Create a new record on an app with complex field names

record = app.records.create(**{'Field 1': 'Field 1 Value','Field 2': 100,...

})

Returns Newly created Record instance with data as returned from API response

Return type Record

Raises

• swimlane.exceptions.UnknownField – If any fields are provided that are notavailable on target app

• swimlane.exceptions.ValidationError – If any field fails validation beforecreation

get(**kwargs)Get a single record by id

Supports resource cache

Changed in version 2.17.0: Added option to retrieve record by tracking_id

Keyword Arguments

• id (str) – Full record ID

• tracking_id (str) – Record Tracking ID

Returns Matching Record instance returned from API

Return type Record

Raises TypeError – No id argument provided

search(*filters, **kwargs)Shortcut to generate a new temporary search report using provided filters and return the resulting records

Parameters *filters (tuple) – Zero or more filter tuples of (field_name, operator,field_value)

Keyword Arguments

40 Chapter 3. Package Docs

Page 45: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

• keywords (list(str)) – List of strings of keywords to use in report search

• limit (int) – Set maximum number of returned Records, defaults to Re-port.default_limit. Set to 0 to return all records

• page_size – Set maximum number of returned Records per page, defaults to 1000. Setto 0 to return all records

• sort – Tuple of (field_name, order) by which results will be sorted

• columns (list(str)) – List of strings of field names to populate in the resultingrecords. Defaults to all available fields

Notes

Uses a temporary Report instance with a random name to facilitate search. Records are normally paginated,but are returned as a single list here, potentially causing performance issues with large searches.

All provided filters are AND’ed together

Filter operators and sort orders are available as constants in swimlane.core.search

Examples

# Return records matching all filters with default limit and page size

from swimlane.core import search

records = app.records.search(('field_name', 'equals', 'field_value'),('other_field', search.NOT_EQ, 'value')

)

# Run keyword search with multiple keywordsrecords = app.records.search(keywords=['example', 'test'])

# Return all records from apprecords = app.records.search(limit=0)

# Populate only the specified field and sort resultsrecords = app.records.search(columns=['field_name'], sort=('field_name',→˓'ascending'))

Returns

List of Record instances returned from the search results

Return type list of Record

swimlane.core.adapters.record.validate_filters_or_records(filters_or_records)Validation for filters_or_records variable from bulk_modify and bulk_delete

3.1. swimlane package 41

Page 46: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

swimlane.core.adapters.record_revision module

class swimlane.core.adapters.record_revision.RecordRevisionAdapter(app,record)

Bases: swimlane.core.resolver.AppResolver

Handles retrieval of Swimlane Record Revision resources

get(revision_number)Gets a specific record revision.

Keyword Arguments revision_number (float) – Record revision number

Returns The RecordRevision for the given revision number.

Return type RecordRevision

get_all()Get all revisions for a single record.

Returns All record revisions for the given record ID.

Return type RecordRevision[]

swimlane.core.adapters.report module

class swimlane.core.adapters.report.ReportAdapter(app)Bases: swimlane.core.resolver.SwimlaneResolver

Handles retrieval and creation of Report resources

build(name, **kwargs)Report instance factory for the adapter’s App

Parameters name (str) – New Report name

Keyword Arguments **kwargs – Extra keyword args passed to Report class

Returns Newly created local Report instance

Return type Report

get(report_id)Retrieve report by ID

Parameters report_id (str) – Full report ID

Returns Corresponding Report instance

Return type Report

list()Retrieve all reports for parent app

Returns List of all returned reports

Return type list of Report

swimlane.core.adapters.task module

class swimlane.core.adapters.task.TaskAdapter(swimlane)Bases: swimlane.core.resolver.SwimlaneResolver

42 Chapter 3. Package Docs

Page 47: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

Handles retreival of Swimlane Task Resources and execution of tasks against records.

execute(task_name, raw_record)Execute job by name.

Returns Response of request from the API endpoint.

get(**kwargs)Get a single task by id or name

list()Retrieve list of all tasks.

Returns List of all tasks.

Return type list of Task

swimlane.core.adapters.usergroup module

class swimlane.core.adapters.usergroup.GroupAdapter(swimlane)Bases: swimlane.core.resolver.SwimlaneResolver

Handles retrieval of Swimlane Group resources

get(**kwargs)Retrieve single group record by id or name

Supports resource cache

Keyword Arguments

• id (str) – Full Group ID

• name (str) – Group name

Raises

• TypeError – Unexpected or more than one keyword argument provided

• ValueError – No matching group found based on provided inputs

Returns Group instance matching provided inputs

Return type Group

list(limit=None)Retrieve list of all groups

Returns List of all Groups

Return type list of Group

class swimlane.core.adapters.usergroup.GroupListCursor(swimlane, limit=None)Bases: swimlane.core.resolver.SwimlaneResolver, swimlane.core.cursor.PaginatedCursor

Handles retrieval and pagination of group list endpoint

class swimlane.core.adapters.usergroup.UserAdapter(swimlane)Bases: swimlane.core.resolver.SwimlaneResolver

Handles retrieval of Swimlane User resources

3.1. swimlane package 43

Page 48: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

get(**kwargs)Retrieve single user record by id or username

Warning: User display names are not unique. If using display_name, method will fail if multipleUsers are returned with the same display name

Keyword Arguments

• id (str) – Full User ID

• display_name (str) – User display name

Returns User instance matching provided inputs

Return type User

Raises

• TypeError – Unexpected or more than one keyword argument provided

• ValueError – No matching user found based on provided inputs, or multiple Users withsame display name

list(limit=None)Retrieve all users

Returns Paginated cursor yielding User instances

Return type UserListCursor

class swimlane.core.adapters.usergroup.UserListCursor(swimlane, limit=None)Bases: swimlane.core.resolver.SwimlaneResolver, swimlane.core.cursor.PaginatedCursor

Handles retrieval and pagination for user list endpoint

swimlane.core.fields package

Abstractions for Swimlane app field types to simplify getting/setting values on records

swimlane.core.fields.resolve_field_class(field_definition)Return field class most fitting of provided Swimlane field definition

Subpackages

swimlane.core.fields.base package

Base classes used to build field abstractions

class swimlane.core.fields.base.ReadOnly(*args, **kwargs)Bases: swimlane.core.fields.base.field.Field

Mixin explicitly disabling setting value via python

44 Chapter 3. Package Docs

Page 49: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

Submodules

swimlane.core.fields.base.cursor module

class swimlane.core.fields.base.cursor.CursorField(*args, **kwargs)Bases: swimlane.core.fields.base.field.Field

Returns a proxy-like FieldCursor instance to support additional functionality

cursorCache and return cursor_class instance

cursor_class = None

for_json()Return list of all cursor items, calling .for_json() if available for best representations

get_initial_elements()Return initial elements to be passed with cursor instantiation

get_python()Create, cache, and return the appropriate cursor instance

class swimlane.core.fields.base.cursor.FieldCursor(field, initial_elements=None)Bases: swimlane.core.cursor.Cursor, swimlane.core.resolver.SwimlaneResolver

Base class for encapsulating a field instance’s complex logic

Useful in abstracting away extra request(s), lazy evaluation, pagination, intensive calculations, etc.

swimlane.core.fields.base.field module

class swimlane.core.fields.base.field.Field(name, record)Bases: swimlane.core.resolver.SwimlaneResolver

Base class for abstracting Swimlane complex types

bulk_modify_support = True

cast_to_bulk_modify(value)Cast single value to bulk modify format, defaults to cast_to_report with added validation

cast_to_python(value)Called during set_swimlane, should accept a single raw value as provided from API

Defaults to no-op

cast_to_report(value)Cast single value to report format, defaults to cast_to_swimlane(value)

cast_to_swimlane(value)Called during get_swimlane, should accept a python value and return swimlane representation

Defaults to no-op

field_type = None

for_json()Return json.dump()-compatible representation of field value

New in version 4.1.0.

3.1. swimlane package 45

Page 50: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

get_batch_representation()Return best batch process representation of field value

get_bulk_modify(value)Return value in format for bulk modify

get_item()Return best python representation of field value for get attribute method

get_python()Return best python representation of field value

get_report(value)Return provided field Python value formatted for use in report filter

get_swimlane()Return best swimlane representation of field value

recordResolve weak reference to parent record

set_python(value)Set field internal value from the python representation of field value

set_swimlane(value)Set field internal value from the swimlane representation of field value

supported_types = []

validate_value(value)Validate value is an acceptable type during set_python operation

swimlane.core.fields.base.multiselect module

class swimlane.core.fields.base.multiselect.MultiSelectCursor(*args, **kwargs)Bases: swimlane.core.fields.base.cursor.FieldCursor

Cursor allowing setting and unsetting values on a MultiSelectField

Respects parent field’s validation

deselect(element)Remove an element from the set of selected elements

Proxy to internal set.remove and sync field

select(element)Add an element to the set of selected elements

Proxy to internal set.add and sync field

class swimlane.core.fields.base.multiselect.MultiSelectField(*args, **kwargs)Bases: swimlane.core.fields.base.cursor.CursorField

Base class for fields that can be multi-selection or single-selection field

cursor_classalias of MultiSelectCursor

for_json()Handle multi-select vs single-select

46 Chapter 3. Package Docs

Page 51: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

get_python()Only return cursor instance if configured for multiselect

get_swimlane()Handle multi-select and single-select modes

set_python(value)Override to remove key from raw data when empty to work with server 2.16+ validation

set_swimlane(value)Cast all multi-select elements to correct internal type like single-select mode

Submodules

swimlane.core.fields.attachment module

class swimlane.core.fields.attachment.AttachmentCursor(field, ini-tial_elements=None)

Bases: swimlane.core.fields.base.cursor.FieldCursor

Allows creation and iteration of attachments

add(filename, stream, content_type=None)Upload a new attachment, and add it to current fields raw data to be persisted on save

Can optionally manually set the content_type, will be guessed by provided filename extension and defaultto application/octet-stream if it cannot be guessed

class swimlane.core.fields.attachment.AttachmentsField(*args, **kwargs)Bases: swimlane.core.fields.base.multiselect.MultiSelectField

bulk_modify_support = False

cast_to_python(value)Called during set_swimlane, should accept a single raw value as provided from API

Defaults to no-op

cast_to_swimlane(value)Called during get_swimlane, should accept a python value and return swimlane representation

Defaults to no-op

cursor_classalias of AttachmentCursor

field_type = ('Core.Models.Fields.AttachmentField, Core', 'Core.Models.Fields.Attachment.AttachmentField, Core')

get_batch_representation()Return best batch process representation of field value

get_initial_elements()Return initial elements to be passed with cursor instantiation

supported_types = [<class 'swimlane.core.resources.attachment.Attachment'>]

swimlane.core.fields.comment module

class swimlane.core.fields.comment.CommentCursor(field, initial_elements=None)Bases: swimlane.core.fields.base.cursor.FieldCursor

3.1. swimlane package 47

Page 52: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

Returned by CommentField to allow iteration and creation of Comment instances

comment(message, rich_text=False)Add new comment to record comment field

class swimlane.core.fields.comment.CommentsField(*args, **kwargs)Bases: swimlane.core.fields.base.ReadOnly , swimlane.core.fields.base.cursor.CursorField

bulk_modify_support = False

cursor_classalias of CommentCursor

field_type = ('Core.Models.Fields.CommentsField, Core', 'Core.Models.Fields.Comments.CommentsField, Core')

get_initial_elements()Return initial elements to be passed with cursor instantiation

swimlane.core.fields.datetime module

class swimlane.core.fields.datetime.DatetimeField(*args, **kwargs)Bases: swimlane.core.fields.base.field.Field

cast_to_python(value)Called during set_swimlane, should accept a single raw value as provided from API

Defaults to no-op

cast_to_swimlane(value)Return datetimes formatted as expected by API and timespans as millisecond epochs

datetime_format = '%Y-%m-%dT%H:%M:%S.%fZ'

field_type = 'Core.Models.Fields.Date.DateField, Core'

for_json()Return date ISO8601 string formats for datetime, date, and time values, milliseconds for intervals

classmethod format_datetime(target_datetime)Format datetime as expected by Swimlane API

get_batch_representation()Return best batch process representation of field value

get_python()Coerce to best date type representation for the field subtype

swimlane.core.fields.history module

class swimlane.core.fields.history.HistoryField(*args, **kwargs)Bases: swimlane.core.fields.base.ReadOnly , swimlane.core.fields.base.cursor.CursorField

bulk_modify_support = False

cursor_classalias of RevisionCursor

field_type = 'Core.Models.Fields.History.HistoryField, Core'

48 Chapter 3. Package Docs

Page 53: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

class swimlane.core.fields.history.RevisionCursor(*args, **kwargs)Bases: swimlane.core.fields.base.cursor.FieldCursor

An iterable object that automatically lazy retrieves and caches history data for a record from API

swimlane.core.fields.list module

class swimlane.core.fields.list.ListField(*args, **kwargs)Bases: swimlane.core.fields.base.cursor.CursorField

Text and Numeric List field

cast_to_bulk_modify(value)List fields use raw list values for bulk modify

cast_to_swimlane(value)Restore swimlane format, attempting to keep initial IDs for any previously existing values

field_type = ('Core.Models.Fields.List.ListField, Core', 'Core.Models.Fields.ListField, Core')

set_python(value)Validate using cursor for consistency between direct set of values vs modification of cursor values

set_swimlane(value)Convert from list of dicts with values to list of values

Cache list items with their ID pairs to restore existing IDs to unmodified values to prevent workflowevaluating on each save for any already existing values

class swimlane.core.fields.list.NumericListFieldCursor(field, ini-tial_elements=None)

Bases: swimlane.core.fields.list._ListFieldCursor

Cursor for Numeric ListField

class swimlane.core.fields.list.TextListFieldCursor(field, initial_elements=None)Bases: swimlane.core.fields.list._ListFieldCursor

Cursor for Text ListField

swimlane.core.fields.number module

class swimlane.core.fields.number.NumberField(*args, **kwargs)Bases: swimlane.core.fields.base.field.Field

field_type = ('Core.Models.Fields.NumericField, Core', 'Core.Models.Fields.Numeric.NumericField, Core')

supported_types = [<class 'numbers.Number'>]

validate_value(value)Validate value is an acceptable type during set_python operation

swimlane.core.fields.reference module

class swimlane.core.fields.reference.ReferenceCursor(*args, **kwargs)Bases: swimlane.core.fields.base.cursor.FieldCursor

Handles lazy retrieval of target records

3.1. swimlane package 49

Page 54: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

add(record)Add a reference to the provided record

remove(record)Remove a reference to the provided record

target_appMake field’s target_app available on cursor

class swimlane.core.fields.reference.ReferenceField(*args, **kwargs)Bases: swimlane.core.fields.base.cursor.CursorField

cast_to_report(value)Cast single value to report format, defaults to cast_to_swimlane(value)

cursor_classalias of ReferenceCursor

field_type = 'Core.Models.Fields.Reference.ReferenceField, Core'

for_json()Return list of all cursor items, calling .for_json() if available for best representations

get_batch_representation()Return best batch process representation of field value

get_item()Return cursor if multi-select, direct value if single-select

get_swimlane()Return list of record ids

set_python(value)Expect list of record instances, convert to a SortedDict for internal representation

set_swimlane(value)Store record ids in separate location for later use, but ignore initial value

supported_types = (<class 'swimlane.core.resources.record.Record'>,)

target_appDefer target app retrieval until requested

validate_value(value)Validate provided record is a part of the appropriate target app for the field

swimlane.core.fields.text module

class swimlane.core.fields.text.TextField(name, record)Bases: swimlane.core.fields.base.field.Field

field_type = ('Core.Models.Fields.TextField, Core', 'Core.Models.Fields.Text.TextField, Core')

set_python(value)Set field internal value from the python representation of field value

supported_types = (<type 'basestring'>,)

50 Chapter 3. Package Docs

Page 55: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

swimlane.core.fields.tracking module

class swimlane.core.fields.tracking.TrackingField(*args, **kwargs)Bases: swimlane.core.fields.base.ReadOnly , swimlane.core.fields.base.field.Field

bulk_modify_support = False

field_type = ('Core.Models.Fields.TrackingField, Core', 'Core.Models.Fields.Tracking.TrackingField, Core')

swimlane.core.fields.usergroup module

class swimlane.core.fields.usergroup.UserGroupField(*args, **kwargs)Bases: swimlane.core.fields.base.multiselect.MultiSelectField

Manages getting/setting users from record User/Group fields

cast_to_python(value)Convert JSON definition to UserGroup object

cast_to_swimlane(value)Dump UserGroup back to JSON representation

field_type = ('Core.Models.Fields.UserGroupField, Core', 'Core.Models.Fields.UserGroup.UserGroupField, Core')

get_batch_representation()Return best batch process representation of field value

set_swimlane(value)Workaround for reports returning an empty usergroup field as a single element list with no id/name

supported_types = [<class 'swimlane.core.resources.usergroup.UserGroup'>]

validate_value(value)Validate new user/group value against any User/Group restrictions

Attempts to resolve generic UserGroup instances if necessary to respect special “Everyone” group, and“All Users” + “All Groups” options

swimlane.core.fields.valueslist module

class swimlane.core.fields.valueslist.ValuesListField(*args, **kwargs)Bases: swimlane.core.fields.base.multiselect.MultiSelectField

cast_to_bulk_modify(value)Bulk modify uses the normal Swimlane representation

cast_to_python(value)Store actual value as internal representation

cast_to_report(value)Report format uses only the value’s id

cast_to_swimlane(value)Rehydrate value back as full JSON representation

field_type = ('Core.Models.Fields.ValuesListField, Core', 'Core.Models.Fields.ValuesList.ValuesListField, Core')

get_batch_representation()Return best batch process representation of field value

3.1. swimlane package 51

Page 56: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

supported_types = (<type 'basestring'>,)

validate_value(value)Validate provided value is one of the valid options

swimlane.core.resources package

Submodules

swimlane.core.resources.app module

class swimlane.core.resources.app.App(swimlane, raw)Bases: swimlane.core.resources.base.APIResource

A single App record instance

Used lookup field definitions and retrieve/create child Record instances

nameApp name

Type str

acronymApp acronym

Type str

descriptionApp description

Type str

idFull App ID

Type str

tracking_idApp tracking ID

Type str

recordsRecordAdapter configured for current App

Type RecordAdapter

reportsReportAdapter configured for current App

Type ReportAdapter

get_cache_index_keys()Return all fields available when retrieving apps

get_field_definition_by_id(field_id)Get JSON field definition for field matching provided id

Parameters field_id (str) – Target field ID to get definition for

Raises swimlane.exceptions.UnknownField – Raised when given a field ID notfound in App

52 Chapter 3. Package Docs

Page 57: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

Returns Field metadata definition

Return type dict

get_field_definition_by_name(field_name)Get JSON field definition for field matching provided name or key

Changed in version 4.1.0: Added support for field keys

Parameters field_name (str) – Target field name or key to get definition for

Raises swimlane.exceptions.UnknownField – Raised when given a field name notfound in App

Returns Field metadata definition

Return type dict

resolve_field_name(field_key)Return the field name matching the given key or None. Searches field keys first, falls back to field names

swimlane.core.resources.app_revision module

class swimlane.core.resources.app_revision.AppRevision(swimlane, raw)Bases: swimlane.core.resources.revision_base.RevisionBase

Encapsulates a single revision returned from a History lookup.

Attributes

modified_dateThe date this app revision was created.

revision_numberThe revision number of this app revision.

statusIndicates whether this revision is the current revision or a historical revision.

userThe user that saved this revision of the record.

versionThe App corresponding to the data contained in this app revision.

SEPARATOR = ' --- '

get_cache_index_keys()Returns cache index keys for this AppRevision.

static get_unique_id(app_id, revision_number)Returns the unique identifier for the given AppRevision.

static parse_unique_id(unique_id)Returns an array containing two items: the app_id and revision number parsed from the given unique_id.

versionReturns an App from the _raw_version info in this app revision. Lazy loaded. Overridden from base class.

3.1. swimlane package 53

Page 58: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

swimlane.core.resources.attachment module

class swimlane.core.resources.attachment.Attachment(swimlane, raw)Bases: swimlane.core.resources.base.APIResource

Abstraction of an attachment from an AttachmentsField

file_idFull file ID used in download request URL

Type str

filenameAttachment filename

Type str

upload_datePendulum datetime when attachment was uploaded

Type pendulum.DateTime

download(chunk_size=1024)Download attachment

Parameters chunk_size (int) – Byte-size of chunked download request stream

Returns Stream ready for reading containing the attachment file contents

Return type BytesIO

for_json()Return metadata for JSON-compatible representation

swimlane.core.resources.base module

class swimlane.core.resources.base.APIResource(swimlane, raw)Bases: swimlane.core.resolver.SwimlaneResolver

Base class for all API resources with an associated $type and/or raw data

get_cache_index_keys()Return dict of key/value pairs used by ResourceCache to map resource values to internal cache instance

get_cache_internal_key()Return real internal cache key for resource instance

class swimlane.core.resources.base.APIResourceMetaclassBases: type

Metaclass for all APIResource classes

swimlane.core.resources.comment module

class swimlane.core.resources.comment.Comment(swimlane, raw)Bases: swimlane.core.resources.base.APIResource

Abstraction of a single comment from a comment field

userUserGroup instance of user who created the comment

54 Chapter 3. Package Docs

Page 59: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

Type UserGroup

created_datePendulum datetime of when comment was created

Type pendulum.DateTime

messageComment message body

Type str

for_json()Called by CommentField.for_json(), returns relevant Comment attributes in JSON-compatible format

swimlane.core.resources.record module

class swimlane.core.resources.record.Record(app, raw)Bases: swimlane.core.resources.base.APIResource

A single Swimlane Record instance

idFull Record ID

Type str

tracking_idRecord tracking ID

Type str

createdPendulum datetime for Record created date

Type pendulum.DateTime

modifiedPendulum datetime for Record last modified date

Type pendulum.DateTime

is_newTrue if Record does not yet exist on server. Other values may be temporarily None if True

Type bool

appApp instance that Record belongs to

Type App

add_restriction(*usergroups)Add UserGroup(s) to list of accounts with access to record

New in version 2.16.1.

UserGroups already in the restricted list can be added multiple times and duplicates will be ignored

Notes:

Parameters *usergroups (UserGroup) – 1 or more Swimlane UserGroup(s) to add to re-striction list

Raises TypeError – If 0 UserGroups provided or provided a non-UserGroup instance

3.1. swimlane package 55

Page 60: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

app

delete()Delete record from Swimlane server

New in version 2.16.1.

Resets to new state, but leaves field data as-is. Saving a deleted record will create a new Swimlane record

Raises ValueError: If record.is_new

execute_task(task_name, timeout=20)

for_json(*field_names)Returns json.dump()-compatible dict representation of the record

New in version 4.1.

Useful for resolving any Cursor, datetime/Pendulum, etc. field values to useful formats outside of Python

Parameters *field_names (str) – Optional subset of field(s) to include in returned dict.Defaults to all fields

Raises UnknownField – Raised if any of field_names not found in parent App

Returns field names -> JSON compatible field values

Return type dict

get_cache_index_keys()Return values available for retrieving records, but only for already existing records

get_field(field_name)Get field instance used to get, set, and serialize internal field value

Parameters field_name (str) – Field name or key to retrieve

Returns Requested field instance

Return type Field

Raises UnknownField – Raised if field_name not found in parent App

lock()Lock the record to the Current User.

Notes:

Warnings:

Args:

patch()Patch record on Swimlane server

Raises ValueError: If record.is_new, or if comments or attachments are attempted to be patched

remove_restriction(*usergroups)Remove UserGroup(s) from list of accounts with access to record

New in version 2.16.1.

Notes:

Warning: Providing no UserGroups will clear the restriction list, opening access to ALL accounts

56 Chapter 3. Package Docs

Page 61: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

Parameters *usergroups (UserGroup) – 0 or more Swimlane UserGroup(s) to removefrom restriction list

Raises

• TypeError – If provided a non-UserGroup instance

• ValueError – If provided UserGroup not in current restriction list

restrictionsReturns cached set of retrieved UserGroups in the record’s list of allowed accounts

save()Persist record changes on Swimlane server

Updates internal raw data with response content from server to guarantee calculated field values matchvalues on server

Raises ValidationError – If any fields fail validation

unlock()Unlock the record.

Notes:

Warnings:

Args:

validate()Explicitly validate field data

Notes

Called automatically during save call before sending data to server

Raises ValidationError – If any fields fail validation

swimlane.core.resources.record.record_factory(app, fields=None)Return a temporary Record instance to be used for field validation and value parsing

Parameters

• app (App) – Target App to create a transient Record instance for

• fields (dict) – Optional dict of fields and values to set on new Record instance beforereturning

Returns Unsaved Record instance to be used for validation, creation, etc.

Return type Record

swimlane.core.resources.record_revision module

class swimlane.core.resources.record_revision.RecordRevision(app, raw)Bases: swimlane.core.resources.revision_base.RevisionBase

Encapsulates a single revision returned from a History lookup.

app_revision_numberThe app revision number this record revision was created using.

3.1. swimlane package 57

Page 62: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

Properties: app_version: Returns an App corresponding to the app_revision_number of this record revision.version: Returns a Record corresponding to the app_version and data contained in this record revision.

app_versionThe app revision corresponding to this record revision. Lazy loaded

versionThe record contained in this record revision. Lazy loaded. Overridden from base class.

swimlane.core.resources.report module

class swimlane.core.resources.report.Report(app, raw, **kwargs)Bases: swimlane.core.resources.base.APIResource, swimlane.core.cursor.PaginatedCursor

A report class used for searching

Can be iterated over to retrieve results

Notes

Record retrieval is lazily evaluated and cached internally, adding a filter and attempting to iterate again will notrespect the additional filter and will return the same set of records each time

Examples

Lazy retrieval of records with direct iteration over report

report = app.reports.build('new-report')report.filter('field_1', 'equals', 'value')

for record in report:do_thing(record)

Full immediate retrieval of all records

report = app.reports.build('new-report')report.filter('field_1', 'doesNotEqual', 'value')

records = list(report)

nameReport name

Type str

Keyword Arguments

• limit (int) – Max number of records to return from report/search

• page_size (int) – Max number of records per page

• keywords (list(str)) – List of keywords to use in report/search

default_limit = 50

58 Chapter 3. Package Docs

Page 63: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

filter(field_name, operand, value)Adds a filter to report

Notes

All filters are currently AND’ed together

Parameters

• field_name (str) – Target field name to filter on

• operand (str) – Operand used in comparison. See swimlane.core.search for options

• value – Target value used in comparison

set_columns(*field_names)Set specified columns for report

Notes

The Tracking Id column is always included

Parameters *field_names (str) – Zero or more column names

sort(field_name, order)Adds a sort to report

Parameters

• field_name (str) – Target field name to sort by

• order (str) – Sort order

swimlane.core.resources.report.report_factory(app, report_name, **kwargs)Report instance factory populating boilerplate raw data

Parameters

• app (App) – Swimlane App instance

• report_name (str) – Generated Report name

Keyword Args **kwargs: Kwargs to pass to the Report class

swimlane.core.resources.revision_base module

class swimlane.core.resources.revision_base.RevisionBase(swimlane, raw)Bases: swimlane.core.resources.base.APIResource

The base class representing a single revision returned from a History lookup.

Attributes

modified_dateThe date this revision was created.

revision_numberThe revision number of this revision.

statusIndicates whether this revision is the current revision or a historical revision.

3.1. swimlane package 59

Page 64: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

userThe user that saved this revision.

for_json()Return revision metadata

version

swimlane.core.resources.task module

class swimlane.core.resources.task.Task(swimlane, raw)Bases: swimlane.core.resources.base.APIResource

swimlane.core.resources.usergroup module

class swimlane.core.resources.usergroup.Group(swimlane, raw)Bases: swimlane.core.resources.usergroup.UserGroup

Swimlane group record

descriptionGroup description

Type str

usersList of users belonging to group.

Type GroupUsersCursor

get_cache_index_keys()Return dict of key/value pairs used by ResourceCache to map resource values to internal cache instance

usersReturns a GroupUsersCursor with list of User instances for this Group

New in version 2.16.2.

class swimlane.core.resources.usergroup.GroupUsersCursor(swimlane, user_ids)Bases: swimlane.core.resolver.SwimlaneResolver, swimlane.core.cursor.Cursor

Handles retrieval for user endpoint

class swimlane.core.resources.usergroup.User(swimlane, raw)Bases: swimlane.core.resources.usergroup.UserGroup

Swimlane user record

usernameUnique username

Type str

display_nameUser display name

Type str

emailUser email

Type str

60 Chapter 3. Package Docs

Page 65: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

get_cache_index_keys()Return dict of key/value pairs used by ResourceCache to map resource values to internal cache instance

class swimlane.core.resources.usergroup.UserGroup(swimlane, raw)Bases: swimlane.core.resources.base.APIResource

Base class for Users and Groups

Notes

Returned in some places where determining whether object is a User or Group is not possible without additionalrequests. Use appropriate adapter on swimlane client to retrieve more specific instance using id as needed

Can be compared to User or Group instances directly without ensuring the classes are the same

idFull user/group ID

Type str

nameUser/group name

Type str

as_usergroup_selection()Converts UserGroup to raw UserGroupSelection for populating record

Returns Formatted UserGroup data as used by selection fields

Return type dict

for_json()Get JSON-compatible representation

resolve()Retrieve and return correct User or Group instance from UserGroup

New in version 2.16.1.

Returns Resolved User or Group instance

Return type User | Group

Submodules

swimlane.core.bulk module

Helpers for bulk methods

class swimlane.core.bulk.Append(value)Bases: swimlane.core.bulk._BulkModificationOperation

Bulk modification ‘Add to existing’ operation

type = 'append'

class swimlane.core.bulk.ClearBases: swimlane.core.bulk._BulkModificationOperation

Bulk modification ‘Clear field’ operation

3.1. swimlane package 61

Page 66: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

type = 'delete'

class swimlane.core.bulk.Remove(value)Bases: swimlane.core.bulk._BulkModificationOperation

Bulk modification ‘Find and remove these’ operation

type = 'subtract'

class swimlane.core.bulk.Replace(value)Bases: swimlane.core.bulk._BulkModificationOperation

Bulk modification ‘Replace with’/’Replace all with’ operation

type = 'create'

swimlane.core.cache module

Module providing support for automatic APIResource caching

A ResourcesCache instance is provided on all Swimlane client instances automatically

New in version 2.16.2.

class swimlane.core.cache.ResourcesCache(per_cache_max_size)Bases: object

Universal APIResource instance cache

Uses separate caches per APIResource type, and provides mapping between available cache keys and real cacheprimary key automatically

cache(resource)Insert a resource instance into appropriate resource cache

clear(*resource_types)Clear cache for each provided APIResource class, or all resources if no classes are provided

swimlane.core.cache.check_cache(resource_type)Decorator for adapter methods to check cache for resource before normally sending requests to retrieve data

Only works with single kwargs, almost always used with @one_of_keyword_only decorator

Parameters resource_type (type(APIResource)) – Subclass of APIResource of cache tobe checked when called

swimlane.core.cache.get_cache_index_key(resource)Return a usable cache lookup key for an already initialized resource

Parameters resource (APIResource|tuple) – APIResource instance or 3-length tuple keyreturned from this function

Raises TypeError – If resource is not an APIResource instance or acceptable 3-length tuple cachekey

swimlane.core.client module

Core Swimlane client class

62 Chapter 3. Package Docs

Page 67: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

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)

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 providedfor all parts

• username (str) – Authentication username

• password (str) – Authentication password

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

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

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

• resource_cache_size (int) – Maximum number of each resource type to keep inmemory 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

hostFull RFC-1738 URL pointing to Swimlane host

Type pyuri.URI

appsAppAdapter configured for current Swimlane instance

Type AppAdapter

usersUserAdapter configured for current Swimlane instance

Type UserAdapter

groupsGroupAdapter configured for current Swimlane instance

Type GroupAdapter

resources_cacheCache checked by all supported adapters for current Swimlane instance

Type ResourcesCache

Examples

3.1. swimlane package 63

Page 68: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

# Establish connection using username passwordswimlane = Swimlane(

'https://192.168.1.1','username','password',verify_ssl=False

)

# Or establish connection using personal access tokenswimlane = Swimlane(

'https://192.168.1.1',access_token='abcdefg',verify_ssl=False

)

# Retrieve an appapp = swimlane.apps.get(name='Target App')

build_numberSwimlane build number

build_versionSwimlane semantic build version

Falls back to product version in pre-2.18 releases

product_versionSwimlane product version

request(method, api_endpoint, **kwargs)Wrapper for underlying requests.Session

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

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 plat-form /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

• swimlane.exceptions.SwimlaneHTTP400Error – On 400 responses with ad-ditional context about the exception

• requests.HTTPError – Any other 4xx/5xx HTTP responses

Returns Successful response instances

Return type requests.Response

64 Chapter 3. Package Docs

Page 69: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

Examples

Request and parse server settings endpoint response

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

settingsRetrieve and cache settings from server

userUser record instance for authenticated user

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

class swimlane.core.client.SwimlaneJwtAuth(swimlane, username, password)Bases: swimlane.core.resolver.SwimlaneResolver

Handles authentication for all requests

authenticate()Send login request and update User instance, login headers, and token expiration

class swimlane.core.client.SwimlaneTokenAuth(swimlane, access_token)Bases: swimlane.core.resolver.SwimlaneResolver

Handles token authentication for all requests

New in version 4.1.0.

swimlane.core.cursor module

class swimlane.core.cursor.CursorBases: object

class swimlane.core.cursor.PaginatedCursor(limit=0, page_size=10)Bases: swimlane.core.cursor.Cursor

Handle paginated lists, exposes hooks to simplify retrieval and parsing of paginated data

default_limit = 0

default_page_size = 10

swimlane.core.resolver module

class swimlane.core.resolver.AppResolver(app)Bases: swimlane.core.resolver.SwimlaneResolver

Provides automatic weakref resolution for Swimlane client and App instance

class swimlane.core.resolver.SwimlaneResolver(swimlane)Bases: object

Provides automatic weakref resolution for Swimlane client to avoid circular references and memory leaks

swimlane.core.search module

Provides handful of constants used in record reports/searches

3.1. swimlane package 65

Page 70: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

swimlane.core.wrappedsession module

class swimlane.core.wrappedsession.WrappedSessionBases: requests.sessions.Session

A wrapper for requests.Session to override ‘verify’ property, ignoring REQUESTS_CA_BUNDLE environmentvariable.

This is a workaround for https://github.com/kennethreitz/requests/issues/3829 (will be fixed in requests 3.0.0)

merge_environment_settings(url, proxies, stream, verify, *args, **kwargs)Check the environment and merge it with some settings.

Return type dict

swimlane.utils package

Utility functions

swimlane.utils.get_recursive_subclasses(cls)Return list of all subclasses for a class, including subclasses of direct subclasses

swimlane.utils.import_submodules(package)Return list of imported module instances from beneath root_package

swimlane.utils.one_of_keyword_only(*valid_keywords)Decorator to help make one-and-only-one keyword-only argument functions more reusable

Notes

Decorated function should take 2 arguments, the first for the key, the second the value

Examples

@one_of_keyword_only('a', 'b', 'c')def func(key, value):

if key == 'a':...

elif key == 'b':...

else:# key = 'c'...

...

func(a=1)func(b=2)func(c=3)

try:func(d=4)

except TypeError:...

try:(continues on next page)

66 Chapter 3. Package Docs

Page 71: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

(continued from previous page)

func(a=1, b=2)except TypeError:

...

Parameters *valid_keywords (str) – All allowed keyword argument names

Raises TypeError – On decorated call, if 0 or 2+ arguments are provided or kwargs contains akey not in valid_keywords

swimlane.utils.random_string(length, source=’abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789’)Return random string of characters from source of specified length

Parameters

• length (int) – Length of the returned string

• source (str) – String of characters to use as options for randomly selected characters.Defaults to alphanumeric

Returns String of length number of characters composed of source characters

Return type str

Submodules

swimlane.utils.version module

swimlane.utils.version.compare_versions(version_a, version_b, zerofill=False)Return direction of version relative to provided version sections

Parameters

• version_a (str) – First version to compare

• version_b (str) – Second version to compare

• zerofill (bool) – If True, treat any missing version sections as 0, otherwise ignoresection. Defaults to False

Returns 0 if equal, -1 if a > b, 1 if a < b

Return type int

Examples

If a is equal to b, return 0 If a is greater than b, return -1 If a is less than b, return 1

>>> compare_versions('2', '2') == 0>>> compare_versions('2', '1') == -1>>> compare_versions('2', '3') == 1

If zerofill is False (default), sections not included in both versions are ignored during comparison

>>> compare_versions('2.13.2', '2.13') == 0>>> compare_versions('2.13.2-1234', '3') == 1

If zerofill is True, any sections in one version not included in other version are set to 0

3.1. swimlane package 67

Page 72: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

>>> compare_versions('2.13.2', '2.13', True) == -1>>> compare_versions('2.13.2-1234', '2.13.2', True) == -1>>> compare_versions('2.13.2', '2.13.2', True) == 0

swimlane.utils.version.get_package_version()Get swimlane package version

Returns Installed swimlane lib package version, or 0.0.0.dev if not fully installed

Return type str

swimlane.utils.version.requires_swimlane_version(min_version=None,max_version=None)

Decorator for SwimlaneResolver methods verifying Swimlane server build version is within a given inclusiverange

Raises

• InvalidVersion – Raised before decorated method call if Swimlane server version isout of provided range

• ValueError – If neither min_version or max_version were provided, or if those valuesconflict (2.15 < 2.14)

3.1.2 Submodules

swimlane.exceptions module

Custom exceptions and errors

exception swimlane.exceptions.InvalidSwimlaneBuildVersion(swimlane, min_version,max_version)

Bases: swimlane.exceptions._InvalidSwimlaneVersion

Raised when method connected to Swimlane with build version outside a required range

exception swimlane.exceptions.InvalidSwimlaneProductVersion(swimlane,min_version,max_version)

Bases: swimlane.exceptions._InvalidSwimlaneVersion

Raised when method connected to Swimlane with product version outside a required range

exception swimlane.exceptions.SwimlaneExceptionBases: exceptions.Exception

Base exception for Swimlane errors

exception swimlane.exceptions.SwimlaneHTTP400Error(http_error)Bases: swimlane.exceptions.SwimlaneException, requests.exceptions.HTTPError

Exception raised when receiving a 400 response with additional context

codeSwimlane error code

Type int

nameHuman-readable Swimlane error name

Type str

68 Chapter 3. Package Docs

Page 73: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

argumentOptional argument included with error or None

Type str

http_errorSource requests.HTTPError caught and used to generate this exception

Type HTTPError

codes = {-1: 'Unknown', 1000: 'PasswordExpired', 1001: 'DuplicateUserName', 1002: 'InvalidUserNameOrPassword', 1003: 'ConfirmPasswordDoesNotMatch', 1004: 'PasswordDoesNotMeetComplexityRequirements', 1005: 'PasswordResetRequired', 1006: 'NewPasswordCannotMatchCurrent', 1007: 'InvalidUser', 1051: 'DuplicateGroupName', 1061: 'DuplicateRoleName', 2000: 'DuplicateFieldName', 2001: 'FieldNameEmpty', 2002: 'InvalidApplicationExportFile', 2003: 'ApplicationNotFound', 2004: 'InvalidCalculation', 2005: 'DuplicateApplicationName', 2006: 'DuplicateAppletName', 2007: 'DuplicateAppletAcronym', 2008: 'DuplicateApplicationAcronym', 2011: 'SectionNameTooLong', 3000: 'DuplicateFieldValue', 3001: 'InvalidDateField', 3002: 'RecordNotFound', 3003: 'FieldNotFound', 3006: 'MaxAttachmentSize', 4000: 'BadStatsGroup', 4001: 'BadFilter', 5000: 'AppLimitExceeded', 5001: 'UserLimitExceeded', 5002: 'NewServerInstall', 5003: 'UnableToConnectToActiveDirectory', 5004: 'UnableToRetrieveStoredValue', 5005: 'UnableToConnectToMongoDb', 5006: 'UnableToConnectToSmtp', 5007: 'SwimlaneAlreadyInitialized', 5008: 'ModelValidationError', 5009: 'UpgradeInProcess', 5010: 'RequiredFieldMissing', 5011: 'UnableToRetrieveEncryptionKey', 5012: 'PathNotFound', 5013: 'WrongType', 5014: 'ModificationError', 5015: 'DatabaseError', 5016: 'NetworkError', 5017: 'InvalidOnThisOS', 6000: 'ConnectionDataNotProvided', 7000: 'RegexNotDefined', 7001: 'AssetNotFound', 9000: 'BadThreatIntelConnector', 9001: 'NoThreatIntel', 9002: 'ThreatIntelTypeNotSupportedByThisProvider', 10000: 'DuplicateTaskName', 10001: 'TaskNotFound', 17001: 'DuplicateAssetName', 19001: 'HangfireError'}

exception swimlane.exceptions.UnknownField(app, field_name, field_pool)Bases: swimlane.exceptions.SwimlaneException, exceptions.KeyError

Raised anytime access is attempted to a field that does not exist on an App or Record

appApp with the unknown field requested

Type App

field_nameName of the field that was requested

Type str

similar_field_namesList of strings of fields on app that are potentially similar to field_name

Type list(str)

exception swimlane.exceptions.ValidationError(record, failure)Bases: swimlane.exceptions.SwimlaneException, exceptions.ValueError

Raised when record’s field data is invalid

recordRecord in context of validation failure

Type Record

failureReason for record failure

Type str

3.1. swimlane package 69

Page 74: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

70 Chapter 3. Package Docs

Page 75: Swimlane Python Documentation

Python Module Index

sswimlane, 33swimlane.core, 35swimlane.core.adapters, 35swimlane.core.adapters.app, 36swimlane.core.adapters.app_revision, 36swimlane.core.adapters.helper, 37swimlane.core.adapters.record, 37swimlane.core.adapters.record_revision,

42swimlane.core.adapters.report, 42swimlane.core.adapters.task, 42swimlane.core.adapters.usergroup, 43swimlane.core.bulk, 61swimlane.core.cache, 62swimlane.core.client, 62swimlane.core.cursor, 65swimlane.core.fields, 44swimlane.core.fields.attachment, 47swimlane.core.fields.base, 44swimlane.core.fields.base.cursor, 45swimlane.core.fields.base.field, 45swimlane.core.fields.base.multiselect,

46swimlane.core.fields.comment, 47swimlane.core.fields.datetime, 48swimlane.core.fields.history, 48swimlane.core.fields.list, 49swimlane.core.fields.number, 49swimlane.core.fields.reference, 49swimlane.core.fields.text, 50swimlane.core.fields.tracking, 51swimlane.core.fields.usergroup, 51swimlane.core.fields.valueslist, 51swimlane.core.resolver, 65swimlane.core.resources, 52swimlane.core.resources.app, 52swimlane.core.resources.app_revision,

53

swimlane.core.resources.attachment, 54swimlane.core.resources.base, 54swimlane.core.resources.comment, 54swimlane.core.resources.record, 55swimlane.core.resources.record_revision,

57swimlane.core.resources.report, 58swimlane.core.resources.revision_base,

59swimlane.core.resources.task, 60swimlane.core.resources.usergroup, 60swimlane.core.search, 65swimlane.core.wrappedsession, 66swimlane.exceptions, 68swimlane.utils, 66swimlane.utils.version, 67

71

Page 76: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

72 Python Module Index

Page 77: Swimlane Python Documentation

Index

Aacronym (swimlane.core.resources.app.App attribute),

52add() (swimlane.core.fields.attachment.AttachmentCursor

method), 47add() (swimlane.core.fields.reference.ReferenceCursor

method), 49add_comment() (swim-

lane.core.adapters.helper.HelperAdaptermethod), 37

add_record_references() (swim-lane.core.adapters.helper.HelperAdaptermethod), 37

add_restriction() (swim-lane.core.resources.record.Record method),55

APIResource (class in swimlane.core.resources.base),54

APIResourceMetaclass (class in swim-lane.core.resources.base), 54

App (class in swimlane.core.resources.app), 52app (swimlane.core.resources.record.Record attribute),

55app (swimlane.exceptions.UnknownField attribute), 69app_revision_number (swim-

lane.core.resources.record_revision.RecordRevisionattribute), 57

app_version (swim-lane.core.resources.record_revision.RecordRevisionattribute), 58

AppAdapter (class in swimlane.core.adapters.app), 36Append (class in swimlane.core.bulk), 61AppResolver (class in swimlane.core.resolver), 65AppRevision (class in swim-

lane.core.resources.app_revision), 53AppRevisionAdapter (class in swim-

lane.core.adapters.app_revision), 36apps (swimlane.core.client.Swimlane attribute), 63apps (swimlane.Swimlane attribute), 34

argument (swimlane.exceptions.SwimlaneHTTP400Errorattribute), 68

as_usergroup_selection() (swim-lane.core.resources.usergroup.UserGroupmethod), 61

Attachment (class in swim-lane.core.resources.attachment), 54

AttachmentCursor (class in swim-lane.core.fields.attachment), 47

AttachmentsField (class in swim-lane.core.fields.attachment), 47

Attributes (swimlane.core.resources.app_revision.AppRevisionattribute), 53

Attributes (swimlane.core.resources.revision_base.RevisionBaseattribute), 59

authenticate() (swim-lane.core.client.SwimlaneJwtAuth method),65

Bbuild() (swimlane.core.adapters.report.ReportAdapter

method), 42build_number (swimlane.core.client.Swimlane

attribute), 64build_number (swimlane.Swimlane attribute), 34build_version (swimlane.core.client.Swimlane at-

tribute), 64build_version (swimlane.Swimlane attribute), 34bulk_create() (swim-

lane.core.adapters.record.RecordAdaptermethod), 37

bulk_delete() (swim-lane.core.adapters.record.RecordAdaptermethod), 38

bulk_modify() (swim-lane.core.adapters.record.RecordAdaptermethod), 39

bulk_modify_support (swim-lane.core.fields.attachment.AttachmentsFieldattribute), 47

73

Page 78: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

bulk_modify_support (swim-lane.core.fields.base.field.Field attribute),45

bulk_modify_support (swim-lane.core.fields.comment.CommentsFieldattribute), 48

bulk_modify_support (swim-lane.core.fields.history.HistoryField attribute),48

bulk_modify_support (swim-lane.core.fields.tracking.TrackingField at-tribute), 51

Ccache() (swimlane.core.cache.ResourcesCache

method), 62cast_to_bulk_modify() (swim-

lane.core.fields.base.field.Field method),45

cast_to_bulk_modify() (swim-lane.core.fields.list.ListField method), 49

cast_to_bulk_modify() (swim-lane.core.fields.valueslist.ValuesListFieldmethod), 51

cast_to_python() (swim-lane.core.fields.attachment.AttachmentsFieldmethod), 47

cast_to_python() (swim-lane.core.fields.base.field.Field method),45

cast_to_python() (swim-lane.core.fields.datetime.DatetimeFieldmethod), 48

cast_to_python() (swim-lane.core.fields.usergroup.UserGroupFieldmethod), 51

cast_to_python() (swim-lane.core.fields.valueslist.ValuesListFieldmethod), 51

cast_to_report() (swim-lane.core.fields.base.field.Field method),45

cast_to_report() (swim-lane.core.fields.reference.ReferenceFieldmethod), 50

cast_to_report() (swim-lane.core.fields.valueslist.ValuesListFieldmethod), 51

cast_to_swimlane() (swim-lane.core.fields.attachment.AttachmentsFieldmethod), 47

cast_to_swimlane() (swim-lane.core.fields.base.field.Field method),45

cast_to_swimlane() (swim-lane.core.fields.datetime.DatetimeFieldmethod), 48

cast_to_swimlane() (swim-lane.core.fields.list.ListField method), 49

cast_to_swimlane() (swim-lane.core.fields.usergroup.UserGroupFieldmethod), 51

cast_to_swimlane() (swim-lane.core.fields.valueslist.ValuesListFieldmethod), 51

check_bulk_job_status() (swim-lane.core.adapters.helper.HelperAdaptermethod), 37

check_cache() (in module swimlane.core.cache), 62Clear (class in swimlane.core.bulk), 61clear() (swimlane.core.cache.ResourcesCache

method), 62code (swimlane.exceptions.SwimlaneHTTP400Error at-

tribute), 68codes (swimlane.exceptions.SwimlaneHTTP400Error

attribute), 69Comment (class in swimlane.core.resources.comment),

54comment() (swimlane.core.fields.comment.CommentCursor

method), 48CommentCursor (class in swim-

lane.core.fields.comment), 47CommentsField (class in swim-

lane.core.fields.comment), 48compare_versions() (in module swim-

lane.utils.version), 67create() (swimlane.core.adapters.record.RecordAdapter

method), 39created (swimlane.core.resources.record.Record at-

tribute), 55created_date (swim-

lane.core.resources.comment.Comment at-tribute), 55

Cursor (class in swimlane.core.cursor), 65cursor (swimlane.core.fields.base.cursor.CursorField

attribute), 45cursor_class (swim-

lane.core.fields.attachment.AttachmentsFieldattribute), 47

cursor_class (swim-lane.core.fields.base.cursor.CursorFieldattribute), 45

cursor_class (swim-lane.core.fields.base.multiselect.MultiSelectFieldattribute), 46

cursor_class (swim-lane.core.fields.comment.CommentsFieldattribute), 48

74 Index

Page 79: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

cursor_class (swim-lane.core.fields.history.HistoryField attribute),48

cursor_class (swim-lane.core.fields.reference.ReferenceFieldattribute), 50

CursorField (class in swim-lane.core.fields.base.cursor), 45

Ddatetime_format (swim-

lane.core.fields.datetime.DatetimeField at-tribute), 48

DatetimeField (class in swim-lane.core.fields.datetime), 48

default_limit (swim-lane.core.cursor.PaginatedCursor attribute),65

default_limit (swim-lane.core.resources.report.Report attribute),58

default_page_size (swim-lane.core.cursor.PaginatedCursor attribute),65

delete() (swimlane.core.resources.record.Recordmethod), 56

description (swimlane.core.resources.app.App at-tribute), 52

description (swim-lane.core.resources.usergroup.Group at-tribute), 60

deselect() (swimlane.core.fields.base.multiselect.MultiSelectCursormethod), 46

display_name (swim-lane.core.resources.usergroup.User attribute),60

download() (swimlane.core.resources.attachment.Attachmentmethod), 54

Eemail (swimlane.core.resources.usergroup.User at-

tribute), 60execute() (swimlane.core.adapters.task.TaskAdapter

method), 43execute_task() (swim-

lane.core.resources.record.Record method),56

Ffailure (swimlane.exceptions.ValidationError at-

tribute), 69Field (class in swimlane.core.fields.base.field), 45field_name (swimlane.exceptions.UnknownField at-

tribute), 69

field_type (swimlane.core.fields.attachment.AttachmentsFieldattribute), 47

field_type (swimlane.core.fields.base.field.Field at-tribute), 45

field_type (swimlane.core.fields.comment.CommentsFieldattribute), 48

field_type (swimlane.core.fields.datetime.DatetimeFieldattribute), 48

field_type (swimlane.core.fields.history.HistoryFieldattribute), 48

field_type (swimlane.core.fields.list.ListField at-tribute), 49

field_type (swimlane.core.fields.number.NumberFieldattribute), 49

field_type (swimlane.core.fields.reference.ReferenceFieldattribute), 50

field_type (swimlane.core.fields.text.TextFieldattribute), 50

field_type (swimlane.core.fields.tracking.TrackingFieldattribute), 51

field_type (swimlane.core.fields.usergroup.UserGroupFieldattribute), 51

field_type (swimlane.core.fields.valueslist.ValuesListFieldattribute), 51

FieldCursor (class in swim-lane.core.fields.base.cursor), 45

file_id (swimlane.core.resources.attachment.Attachmentattribute), 54

filename (swimlane.core.resources.attachment.Attachmentattribute), 54

filter() (swimlane.core.resources.report.Reportmethod), 58

for_json() (swimlane.core.fields.base.cursor.CursorFieldmethod), 45

for_json() (swimlane.core.fields.base.field.Fieldmethod), 45

for_json() (swimlane.core.fields.base.multiselect.MultiSelectFieldmethod), 46

for_json() (swimlane.core.fields.datetime.DatetimeFieldmethod), 48

for_json() (swimlane.core.fields.reference.ReferenceFieldmethod), 50

for_json() (swimlane.core.resources.attachment.Attachmentmethod), 54

for_json() (swimlane.core.resources.comment.Commentmethod), 55

for_json() (swimlane.core.resources.record.Recordmethod), 56

for_json() (swimlane.core.resources.revision_base.RevisionBasemethod), 60

for_json() (swimlane.core.resources.usergroup.UserGroupmethod), 61

format_datetime() (swim-lane.core.fields.datetime.DatetimeField class

Index 75

Page 80: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

method), 48

Gget() (swimlane.core.adapters.app.AppAdapter

method), 36get() (swimlane.core.adapters.app_revision.AppRevisionAdapter

method), 36get() (swimlane.core.adapters.record.RecordAdapter

method), 40get() (swimlane.core.adapters.record_revision.RecordRevisionAdapter

method), 42get() (swimlane.core.adapters.report.ReportAdapter

method), 42get() (swimlane.core.adapters.task.TaskAdapter

method), 43get() (swimlane.core.adapters.usergroup.GroupAdapter

method), 43get() (swimlane.core.adapters.usergroup.UserAdapter

method), 43get_all() (swimlane.core.adapters.app_revision.AppRevisionAdapter

method), 36get_all() (swimlane.core.adapters.record_revision.RecordRevisionAdapter

method), 42get_batch_representation() (swim-

lane.core.fields.attachment.AttachmentsFieldmethod), 47

get_batch_representation() (swim-lane.core.fields.base.field.Field method),45

get_batch_representation() (swim-lane.core.fields.datetime.DatetimeFieldmethod), 48

get_batch_representation() (swim-lane.core.fields.reference.ReferenceFieldmethod), 50

get_batch_representation() (swim-lane.core.fields.usergroup.UserGroupFieldmethod), 51

get_batch_representation() (swim-lane.core.fields.valueslist.ValuesListFieldmethod), 51

get_bulk_modify() (swim-lane.core.fields.base.field.Field method),46

get_cache_index_key() (in module swim-lane.core.cache), 62

get_cache_index_keys() (swim-lane.core.resources.app.App method), 52

get_cache_index_keys() (swim-lane.core.resources.app_revision.AppRevisionmethod), 53

get_cache_index_keys() (swim-lane.core.resources.base.APIResourcemethod), 54

get_cache_index_keys() (swim-lane.core.resources.record.Record method),56

get_cache_index_keys() (swim-lane.core.resources.usergroup.Group method),60

get_cache_index_keys() (swim-lane.core.resources.usergroup.User method),60

get_cache_internal_key() (swim-lane.core.resources.base.APIResourcemethod), 54

get_field() (swimlane.core.resources.record.Recordmethod), 56

get_field_definition_by_id() (swim-lane.core.resources.app.App method), 52

get_field_definition_by_name() (swim-lane.core.resources.app.App method), 53

get_initial_elements() (swim-lane.core.fields.attachment.AttachmentsFieldmethod), 47

get_initial_elements() (swim-lane.core.fields.base.cursor.CursorFieldmethod), 45

get_initial_elements() (swim-lane.core.fields.comment.CommentsFieldmethod), 48

get_item() (swimlane.core.fields.base.field.Fieldmethod), 46

get_item() (swimlane.core.fields.reference.ReferenceFieldmethod), 50

get_package_version() (in module swim-lane.utils.version), 68

get_python() (swim-lane.core.fields.base.cursor.CursorFieldmethod), 45

get_python() (swimlane.core.fields.base.field.Fieldmethod), 46

get_python() (swim-lane.core.fields.base.multiselect.MultiSelectFieldmethod), 46

get_python() (swim-lane.core.fields.datetime.DatetimeFieldmethod), 48

get_recursive_subclasses() (in module swim-lane.utils), 66

get_report() (swimlane.core.fields.base.field.Fieldmethod), 46

get_swimlane() (swim-lane.core.fields.base.field.Field method),46

get_swimlane() (swim-lane.core.fields.base.multiselect.MultiSelectFieldmethod), 47

76 Index

Page 81: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

get_swimlane() (swim-lane.core.fields.reference.ReferenceFieldmethod), 50

get_unique_id() (swim-lane.core.resources.app_revision.AppRevisionstatic method), 53

Group (class in swimlane.core.resources.usergroup), 60GroupAdapter (class in swim-

lane.core.adapters.usergroup), 43GroupListCursor (class in swim-

lane.core.adapters.usergroup), 43groups (swimlane.core.client.Swimlane attribute), 63groups (swimlane.Swimlane attribute), 34GroupUsersCursor (class in swim-

lane.core.resources.usergroup), 60

HHelperAdapter (class in swim-

lane.core.adapters.helper), 37HistoryField (class in swimlane.core.fields.history),

48host (swimlane.core.client.Swimlane attribute), 63host (swimlane.Swimlane attribute), 34http_error (swimlane.exceptions.SwimlaneHTTP400Error

attribute), 69

Iid (swimlane.core.resources.app.App attribute), 52id (swimlane.core.resources.record.Record attribute), 55id (swimlane.core.resources.usergroup.UserGroup at-

tribute), 61import_submodules() (in module swimlane.utils),

66InvalidSwimlaneBuildVersion, 68InvalidSwimlaneProductVersion, 68is_new (swimlane.core.resources.record.Record at-

tribute), 55

Llist() (swimlane.core.adapters.app.AppAdapter

method), 36list() (swimlane.core.adapters.report.ReportAdapter

method), 42list() (swimlane.core.adapters.task.TaskAdapter

method), 43list() (swimlane.core.adapters.usergroup.GroupAdapter

method), 43list() (swimlane.core.adapters.usergroup.UserAdapter

method), 44ListField (class in swimlane.core.fields.list), 49lock() (swimlane.core.resources.record.Record

method), 56

Mmerge_environment_settings() (swim-

lane.core.wrappedsession.WrappedSessionmethod), 66

message (swimlane.core.resources.comment.Commentattribute), 55

modified (swimlane.core.resources.record.Record at-tribute), 55

modified_date (swim-lane.core.resources.app_revision.AppRevisionattribute), 53

modified_date (swim-lane.core.resources.revision_base.RevisionBaseattribute), 59

MultiSelectCursor (class in swim-lane.core.fields.base.multiselect), 46

MultiSelectField (class in swim-lane.core.fields.base.multiselect), 46

Nname (swimlane.core.resources.app.App attribute), 52name (swimlane.core.resources.report.Report attribute),

58name (swimlane.core.resources.usergroup.UserGroup

attribute), 61name (swimlane.exceptions.SwimlaneHTTP400Error at-

tribute), 68NumberField (class in swimlane.core.fields.number),

49NumericListFieldCursor (class in swim-

lane.core.fields.list), 49

Oone_of_keyword_only() (in module swim-

lane.utils), 66

PPaginatedCursor (class in swimlane.core.cursor),

65parse_unique_id() (swim-

lane.core.resources.app_revision.AppRevisionstatic method), 53

patch() (swimlane.core.resources.record.Recordmethod), 56

product_version (swimlane.core.client.Swimlaneattribute), 64

product_version (swimlane.Swimlane attribute), 34

Rrandom_string() (in module swimlane.utils), 67ReadOnly (class in swimlane.core.fields.base), 44Record (class in swimlane.core.resources.record), 55record (swimlane.core.fields.base.field.Field attribute),

46

Index 77

Page 82: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

record (swimlane.exceptions.ValidationError at-tribute), 69

record_factory() (in module swim-lane.core.resources.record), 57

RecordAdapter (class in swim-lane.core.adapters.record), 37

RecordRevision (class in swim-lane.core.resources.record_revision), 57

RecordRevisionAdapter (class in swim-lane.core.adapters.record_revision), 42

records (swimlane.core.resources.app.App attribute),52

ReferenceCursor (class in swim-lane.core.fields.reference), 49

ReferenceField (class in swim-lane.core.fields.reference), 50

Remove (class in swimlane.core.bulk), 62remove() (swimlane.core.fields.reference.ReferenceCursor

method), 50remove_restriction() (swim-

lane.core.resources.record.Record method),56

Replace (class in swimlane.core.bulk), 62Report (class in swimlane.core.resources.report), 58report_factory() (in module swim-

lane.core.resources.report), 59ReportAdapter (class in swim-

lane.core.adapters.report), 42reports (swimlane.core.resources.app.App attribute),

52request() (swimlane.core.client.Swimlane method),

64request() (swimlane.Swimlane method), 34requires_swimlane_version() (in module

swimlane.utils.version), 68resolve() (swimlane.core.resources.usergroup.UserGroup

method), 61resolve_field_class() (in module swim-

lane.core.fields), 44resolve_field_name() (swim-

lane.core.resources.app.App method), 53resources_cache (swimlane.core.client.Swimlane

attribute), 63resources_cache (swimlane.Swimlane attribute), 34ResourcesCache (class in swimlane.core.cache), 62restrictions (swim-

lane.core.resources.record.Record attribute),57

revision_number (swim-lane.core.resources.app_revision.AppRevisionattribute), 53

revision_number (swim-lane.core.resources.revision_base.RevisionBaseattribute), 59

RevisionBase (class in swim-lane.core.resources.revision_base), 59

RevisionCursor (class in swim-lane.core.fields.history), 48

Ssave() (swimlane.core.resources.record.Record

method), 57search() (swimlane.core.adapters.record.RecordAdapter

method), 40select() (swimlane.core.fields.base.multiselect.MultiSelectCursor

method), 46SEPARATOR (swimlane.core.resources.app_revision.AppRevision

attribute), 53set_columns() (swim-

lane.core.resources.report.Report method),59

set_python() (swimlane.core.fields.base.field.Fieldmethod), 46

set_python() (swim-lane.core.fields.base.multiselect.MultiSelectFieldmethod), 47

set_python() (swimlane.core.fields.list.ListFieldmethod), 49

set_python() (swim-lane.core.fields.reference.ReferenceFieldmethod), 50

set_python() (swimlane.core.fields.text.TextFieldmethod), 50

set_swimlane() (swim-lane.core.fields.base.field.Field method),46

set_swimlane() (swim-lane.core.fields.base.multiselect.MultiSelectFieldmethod), 47

set_swimlane() (swimlane.core.fields.list.ListFieldmethod), 49

set_swimlane() (swim-lane.core.fields.reference.ReferenceFieldmethod), 50

set_swimlane() (swim-lane.core.fields.usergroup.UserGroupFieldmethod), 51

settings (swimlane.core.client.Swimlane attribute),65

settings (swimlane.Swimlane attribute), 35similar_field_names (swim-

lane.exceptions.UnknownField attribute),69

sort() (swimlane.core.resources.report.Reportmethod), 59

status (swimlane.core.resources.app_revision.AppRevisionattribute), 53

78 Index

Page 83: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

status (swimlane.core.resources.revision_base.RevisionBaseattribute), 59

supported_types (swim-lane.core.fields.attachment.AttachmentsFieldattribute), 47

supported_types (swim-lane.core.fields.base.field.Field attribute),46

supported_types (swim-lane.core.fields.number.NumberField attribute),49

supported_types (swim-lane.core.fields.reference.ReferenceFieldattribute), 50

supported_types (swim-lane.core.fields.text.TextField attribute),50

supported_types (swim-lane.core.fields.usergroup.UserGroupFieldattribute), 51

supported_types (swim-lane.core.fields.valueslist.ValuesListFieldattribute), 51

Swimlane (class in swimlane), 33Swimlane (class in swimlane.core.client), 62swimlane (module), 33swimlane.core (module), 35swimlane.core.adapters (module), 35swimlane.core.adapters.app (module), 36swimlane.core.adapters.app_revision

(module), 36swimlane.core.adapters.helper (module), 37swimlane.core.adapters.record (module), 37swimlane.core.adapters.record_revision

(module), 42swimlane.core.adapters.report (module), 42swimlane.core.adapters.task (module), 42swimlane.core.adapters.usergroup (mod-

ule), 43swimlane.core.bulk (module), 61swimlane.core.cache (module), 62swimlane.core.client (module), 62swimlane.core.cursor (module), 65swimlane.core.fields (module), 44swimlane.core.fields.attachment (module),

47swimlane.core.fields.base (module), 44swimlane.core.fields.base.cursor (mod-

ule), 45swimlane.core.fields.base.field (module),

45swimlane.core.fields.base.multiselect

(module), 46swimlane.core.fields.comment (module), 47

swimlane.core.fields.datetime (module), 48swimlane.core.fields.history (module), 48swimlane.core.fields.list (module), 49swimlane.core.fields.number (module), 49swimlane.core.fields.reference (module),

49swimlane.core.fields.text (module), 50swimlane.core.fields.tracking (module), 51swimlane.core.fields.usergroup (module),

51swimlane.core.fields.valueslist (module),

51swimlane.core.resolver (module), 65swimlane.core.resources (module), 52swimlane.core.resources.app (module), 52swimlane.core.resources.app_revision

(module), 53swimlane.core.resources.attachment (mod-

ule), 54swimlane.core.resources.base (module), 54swimlane.core.resources.comment (module),

54swimlane.core.resources.record (module),

55swimlane.core.resources.record_revision

(module), 57swimlane.core.resources.report (module),

58swimlane.core.resources.revision_base

(module), 59swimlane.core.resources.task (module), 60swimlane.core.resources.usergroup (mod-

ule), 60swimlane.core.search (module), 65swimlane.core.wrappedsession (module), 66swimlane.exceptions (module), 68swimlane.utils (module), 66swimlane.utils.version (module), 67SwimlaneException, 68SwimlaneHTTP400Error, 68SwimlaneJwtAuth (class in swimlane.core.client), 65SwimlaneResolver (class in swim-

lane.core.resolver), 65SwimlaneTokenAuth (class in swimlane.core.client),

65

Ttarget_app (swimlane.core.fields.reference.ReferenceCursor

attribute), 50target_app (swimlane.core.fields.reference.ReferenceField

attribute), 50Task (class in swimlane.core.resources.task), 60TaskAdapter (class in swimlane.core.adapters.task),

42

Index 79

Page 84: Swimlane Python Documentation

Swimlane Python Documentation, Release 10.7.0

TextField (class in swimlane.core.fields.text), 50TextListFieldCursor (class in swim-

lane.core.fields.list), 49tracking_id (swimlane.core.resources.app.App at-

tribute), 52tracking_id (swimlane.core.resources.record.Record

attribute), 55TrackingField (class in swim-

lane.core.fields.tracking), 51type (swimlane.core.bulk.Append attribute), 61type (swimlane.core.bulk.Clear attribute), 61type (swimlane.core.bulk.Remove attribute), 62type (swimlane.core.bulk.Replace attribute), 62

UUnknownField, 69unlock() (swimlane.core.resources.record.Record

method), 57upload_date (swim-

lane.core.resources.attachment.Attachmentattribute), 54

User (class in swimlane.core.resources.usergroup), 60user (swimlane.core.client.Swimlane attribute), 65user (swimlane.core.resources.app_revision.AppRevision

attribute), 53user (swimlane.core.resources.comment.Comment at-

tribute), 54user (swimlane.core.resources.revision_base.RevisionBase

attribute), 59user (swimlane.Swimlane attribute), 35UserAdapter (class in swim-

lane.core.adapters.usergroup), 43UserGroup (class in swim-

lane.core.resources.usergroup), 61UserGroupField (class in swim-

lane.core.fields.usergroup), 51UserListCursor (class in swim-

lane.core.adapters.usergroup), 44username (swimlane.core.resources.usergroup.User at-

tribute), 60users (swimlane.core.client.Swimlane attribute), 63users (swimlane.core.resources.usergroup.Group at-

tribute), 60users (swimlane.Swimlane attribute), 34

Vvalidate() (swimlane.core.resources.record.Record

method), 57validate_filters_or_records() (in module

swimlane.core.adapters.record), 41validate_value() (swim-

lane.core.fields.base.field.Field method),46

validate_value() (swim-lane.core.fields.number.NumberField method),49

validate_value() (swim-lane.core.fields.reference.ReferenceFieldmethod), 50

validate_value() (swim-lane.core.fields.usergroup.UserGroupFieldmethod), 51

validate_value() (swim-lane.core.fields.valueslist.ValuesListFieldmethod), 52

ValidationError, 69ValuesListField (class in swim-

lane.core.fields.valueslist), 51version (swimlane.core.client.Swimlane attribute), 65version (swimlane.core.resources.app_revision.AppRevision

attribute), 53version (swimlane.core.resources.record_revision.RecordRevision

attribute), 58version (swimlane.core.resources.revision_base.RevisionBase

attribute), 60version (swimlane.Swimlane attribute), 35

WWrappedSession (class in swim-

lane.core.wrappedsession), 66

80 Index