swimlane-connector-utilities
This package contains utility functions to be used in Swimlane Connectors.
Swimlane Attachments
This helper function is to create attachments easily, in Swimlane output format. You can either create a single attachment, with create_attachment
from swimlane_connector_utilities import create_attachment
output = {
"attachment_key1": create_attachment("myfile.txt", "this is a text file")
"attachment_key2": create_attachment("myfile.exe", <byte data here>)
}
Or multiple attachments with SwimlaneAttachments
from swimlane_connector_utilities import SwimlaneAttachments
swa = SwimlaneAttachments()
swa.add_attachment("myfile.txt", "this is a text file")
swa.add_attachment("myfile.exe", <byte data here>)
output = {
"attachment_list": swa.get_attachments()
}
Create Test Connection
Creating test connections can be repetitive, so a test connection that looks like this:
from swimlane_connector_utilities import create_test_conn
# My Integration Auth, copied from __init__.py for example purposes
class MyIntegration(object):
def __init__(self, context):
# Do auth here
pass
def do_auth(self):
pass
class SwMain(object):
def __init__(self, context):
self.context = context
def execute(self):
try:
MyIntegration(self.context).do_auth()
return {"successful": True}
except Exception as e:
return {"successful": False, "errorMessage": str(e)}
Can be easily turned into
from swimlane_connector_utilities import create_test_conn
# My Integration Auth, copied from __init__.py for example purposes
class MyIntegration(object):
def __init__(self, context):
# Do auth here
pass
def do_auth(self):
pass
SwMain = create_test_conn(MyIntegration, execute_func="do_auth")
Note that if you do authentication in init you can exclude the execute_func param
Parse Datetime
datetime inputs can be many different formats and often we want to accept a time relative
to the current time, such as 10 minutes ago. To handle all datetime inputs, you can use
the function parse_datetime. This function accepts all common datetime formats as well
as the relative time format below, and returns a pendulum object. An InvalidInput error
will be raised if it is not a valid datetime.
Relative datetime format:
For the current time:
now
Any other time:
(+/-)(integer) (milliseconds|seconds|minutes|days|weeks|months|years)
examples:
now
-1 months
+3 days
-123 seconds
parse_datetime can be used to parse the input, then convert the pendulum object to the format the api requires.
from swimlane_connector_utilities import parse_datetime
data = {"time_1": "2020-02-02 10:10:10", "time_2": "-5 minutes", "text_field": "text"}
for field in ["time_1", "time_2"]:
data[field] = parse_datetime(field, data[field]).to_iso8601_string()
Metadata
Release files for swimlane-connector-utilities 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| swimlane_connector_utilities-1.1.0.tar.gz | 11.6 kB | Without provenance | Details for swimlane_connector_utilities-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swimlane_connector_utilities-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for swimlane_connector_utilities-1.1.0-py3-none-any.whl |
Total release size: 18.9 kB
Release files / swimlane_connector_utilities-1.1.0.tar.gz
| Download URL | swimlane_connector_utilities-1.1.0.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
acf59b31937bb64c81d0186b3bbc046bb05d396ca45876214a490a4224c4f6a3
|
|
BLAKE2b-256 checksum How to use checksums |
747fdb2fd8ac782e5a1eb8e7447ef330495487919dea3aed53e6f232aa710b71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Release files / swimlane_connector_utilities-1.1.0-py3-none-any.whl
| Download URL | swimlane_connector_utilities-1.1.0-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eada9736dc722411a512bf4dfcb02b15b6df090499a8108f639b3a276f52dc40
|
|
BLAKE2b-256 checksum How to use checksums |
1a28a21854ec8e92b9168374886e7275960d54566bd2eef057941550eaecb00c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Security for swimlane-connector-utilities 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.