Skip to main content

CI Release Version

DutyCalls SDK

DutyCalls SDK for the Python language.



Installation

The easiest way is to use PyPI:

pip install dutycalls_sdk

Client

The DutyCalls Client needs to be initialized using a login and password.

See the documentation for instructions on how to get these credentials.

Example:

from dutycalls import Client

client = Client(login='abcdef123456', password='abcdef123456')

New ticket

Create a new ticket in DutyCalls.

Return value

[
    {
        "sid": 'XXXXXX...',
        "channel": "my-first-channel"
    },
    {
        "sid": 'YYYYYY...',
        "channel": "my-second-channel"
    }
]

Example

# This ticket is based on a default source, you might have to
# change the ticket according your own source mapping.
ticket = {
    'title': 'My Test Ticket',
    'body': 'This is an example'
}

# multiple channels are supported
channels = 'my-first-channel', 'my-second-channel'

await client.new_ticket(ticket=ticket, *channels)

Close tickets

Close one or more ticket(s) in DutyCalls.

Return value

None

Example

# Closes two tickets. The comment argument is optional.
await client.close_tickets(
    'aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIdCxIHY2hhbm5lbBiwhAUMCxIGdGlja2V0GPODDAyiAQpwcm9kdWN0aW9u',
    'aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIbCxIHY2hhbm5lbBiDBwwLEgZ0aWNrZXQYlgoMogEKcGxheWdyb3VuZA',
    comment='Closed by the DutyCalls SDK'
)

Unacknowledge tickets

Un-acknowledge one or more ticket(s) in DutyCalls.

Return value

None

Example

# Un-acknowledges two tickets. The comment argument is optional.
await client.unacknowledge_tickets(
    'aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIdCxIHY2hhbm5lbBiwhAUMCxIGdGlja2V0GPODDAyiAQpwcm9kdWN0aW9u',
    'aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIbCxIHY2hhbm5lbBiDBwwLEgZ0aWNrZXQYlgoMogEKcGxheWdyb3VuZA',
    comment='Unacknowledged by the DutyCalls SDK'
)

Get tickets

Return one or more ticket(s) in DutyCalls.

Return value

    [
        {
            "utc_time": 1632724764,
            "utc_received_time": 1632724764,
            "utc_acknowledged_time": null,
            "utc_closed_time": null,
            "title": "This is the title of the ticket.",
            "body": "This is the body of the ticket.",
            "body_type": "markdown",
            "severity": 1.0,
            "sender": "Me",
            "links": [],
            "identifier": null,
            "tags": [
                {
                    "#": 196687
                }
            ],
            "channel": "example-channel",
            "source": "example-source",
            "status": "unacknowledged",
            "assignee": null,
            "sid": "aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIdCxIHY2hhbm5lbBiwhAUMCxIGdGlja2V0GPODDAyiAQpwcm9kdWN0aW9u"
        }
    ]

Example

# Returns a ticket.
await client.get_tickets(
    'aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIdCxIHY2hhbm5lbBiwhAUMCxIGdGlja2V0GPODDAyiAQpwcm9kdWN0aW9u'
)

New ticket hit

Add a new hit to one or more ticket(s) in DutyCalls.

Return value

None

Example

# Adds a new hit to a ticket.
await client.new_ticket_hit(
    {
        "summary": "The summary.",
        "timestamp": 1621951028,
        "ticketProperties": {
            "links": ["https://some-domain.com"],
            "severity": "high"
        }
    },
    'aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIdCxIHY2hhbm5lbBiwhAUMCxIGdGlja2V0GPODDAyiAQpwcm9kdWN0aW9u'
)

Get ticket hits

Retrieve the hits of a ticket in DutyCalls.

Return value

[
    {
        "unix_time": 1633085094,
        "unix_received_time": 1633085094,
        "summary": "This is the summary of the ticket."
    }
]

Example

# Returns the hits of a given ticket.
await client.get_ticket_hits(
    'aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIdCxIHY2hhbm5lbBiwhAUMCxIGdGlja2V0GPODDAyiAQpwcm9kdWN0aW9u'
)

Metadata

Release files for dutycalls-sdk 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dutycalls-sdk 0.4.0
File Size Uploaded
dutycalls_sdk-0.4.0.tar.gz 5.2 kB Details

Release files / dutycalls_sdk-0.4.0.tar.gz

Download URL dutycalls_sdk-0.4.0.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c70a54bbb9cd3467475c452c5929d7c342430ea3bb2332b4a69eaf83a25f8cce
BLAKE2b-256 checksum
How to use checksums
6d336b35702cd0a44622e0b95e307cea45160d2c22033580b2abeeb652fab2bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.4.0 This release

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page