DutyCalls.me SDK
项目描述
使命召唤 SDK
适用于 Python 语言的 DutyCalls SDK。
安装
最简单的方法是使用 PyPI:
pip install dutycalls_sdk
客户
DutyCalls 客户端需要使用login和进行初始化password。
有关如何获取这些凭据的说明,请参阅文档。
例子:
from dutycalls import Client
client = Client(login='abcdef123456', password='abcdef123456')
新票
在 DutyCalls 中创建新工单。
返回值
[
{
"sid": 'XXXXXX...',
"channel": "my-first-channel"
},
{
"sid": 'YYYYYY...',
"channel": "my-second-channel"
}
]
例子
# 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)
关闭门票
在 DutyCalls 中关闭一张或多张工单。
返回值
None
例子
# Closes two tickets. The comment argument is optional.
await client.close_tickets(
'aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIdCxIHY2hhbm5lbBiwhAUMCxIGdGlja2V0GPODDAyiAQpwcm9kdWN0aW9u',
'aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIbCxIHY2hhbm5lbBiDBwwLEgZ0aWNrZXQYlgoMogEKcGxheWdyb3VuZA',
comment='Closed by the DutyCalls SDK'
)
取消确认票
在 DutyCalls 中取消确认一张或多张票。
返回值
None
例子
# Un-acknowledges two tickets. The comment argument is optional.
await client.unacknowledge_tickets(
'aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIdCxIHY2hhbm5lbBiwhAUMCxIGdGlja2V0GPODDAyiAQpwcm9kdWN0aW9u',
'aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIbCxIHY2hhbm5lbBiDBwwLEgZ0aWNrZXQYlgoMogEKcGxheWdyb3VuZA',
comment='Unacknowledged by the DutyCalls SDK'
)
获得门票
在 DutyCalls 中退回一张或多张票。
返回值
[
{
"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"
}
]
例子
# Returns a ticket.
await client.get_tickets(
'aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIdCxIHY2hhbm5lbBiwhAUMCxIGdGlja2V0GPODDAyiAQpwcm9kdWN0aW9u'
)
新票命中
在 DutyCalls 中为一张或多张工单添加新的点击。
返回值
None
例子
# 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'
)
获得门票命中
在 DutyCalls 中检索票的命中。
返回值
[
{
"unix_time": 1633085094,
"unix_received_time": 1633085094,
"summary": "This is the summary of the ticket."
}
]
例子
# Returns the hits of a given ticket.
await client.get_ticket_hits(
'aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIdCxIHY2hhbm5lbBiwhAUMCxIGdGlja2V0GPODDAyiAQpwcm9kdWN0aW9u'
)
项目详情
关
dutycalls_sdk -0.4.0.tar.gz 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | c70a54bbb9cd3467475c452c5929d7c342430ea3bb2332b4a69eaf83a25f8cce |
|
| MD5 | c6ec550d252258da95e28eef4f3bf017 |
|
| 布莱克2-256 | 6d336b35702cd0a44622e0b95e307cea45160d2c22033580b2abeeb652fab2bf |