Skip to main content

DutyCalls.me SDK

Project description

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'
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dutycalls_sdk-0.4.0.tar.gz (5.2 kB view details)

Uploaded Source

File details

Details for the file dutycalls_sdk-0.4.0.tar.gz.

File metadata

  • Download URL: dutycalls_sdk-0.4.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for dutycalls_sdk-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c70a54bbb9cd3467475c452c5929d7c342430ea3bb2332b4a69eaf83a25f8cce
MD5 c6ec550d252258da95e28eef4f3bf017
BLAKE2b-256 6d336b35702cd0a44622e0b95e307cea45160d2c22033580b2abeeb652fab2bf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page