Package: dutycalls-sdk
DutyCalls SDKDutyCalls SDK for the Python language.InstallationClientNew ticketClose ticketsUnacknowledge ticketsGet ticketsNew ticket hitGet ticket hitsInstallationThe easiest way is to use PyPI:pipinstalldutycalls_sdkClientThe DutyCalls Client needs to be initialized using aloginandpassword.See thedocumentationfor instructions on how to get these credentials.Example:fromdutycallsimportClientclient=Client(login='abcdef123456',password='abcdef123456')New ticketCreate 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 supportedchannels='my-first-channel','my-second-channel'awaitclient.new_ticket(ticket=ticket,*channels)Close ticketsClose one or more ticket(s) in DutyCalls.Return valueNoneExample# Closes two tickets. The comment argument is optional.awaitclient.close_tickets('aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIdCxIHY2hhbm5lbBiwhAUMCxIGdGlja2V0GPODDAyiAQpwcm9kdWN0aW9u','aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIbCxIHY2hhbm5lbBiDBwwLEgZ0aWNrZXQYlgoMogEKcGxheWdyb3VuZA',comment='Closed by the DutyCalls SDK')Unacknowledge ticketsUn-acknowledge one or more ticket(s) in DutyCalls.Return valueNoneExample# Un-acknowledges two tickets. The comment argument is optional.awaitclient.unacknowledge_tickets('aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIdCxIHY2hhbm5lbBiwhAUMCxIGdGlja2V0GPODDAyiAQpwcm9kdWN0aW9u','aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIbCxIHY2hhbm5lbBiDBwwLEgZ0aWNrZXQYlgoMogEKcGxheWdyb3VuZA',comment='Unacknowledged by the DutyCalls SDK')Get ticketsReturn 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.awaitclient.get_tickets('aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIdCxIHY2hhbm5lbBiwhAUMCxIGdGlja2V0GPODDAyiAQpwcm9kdWN0aW9u')New ticket hitAdd a new hit to one or more ticket(s) in DutyCalls.Return valueNoneExample# Adds a new hit to a ticket.awaitclient.new_ticket_hit({"summary":"The summary.","timestamp":1621951028,"ticketProperties":{"links":["https://some-domain.com"],"severity":"high"}},'aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIdCxIHY2hhbm5lbBiwhAUMCxIGdGlja2V0GPODDAyiAQpwcm9kdWN0aW9u')Get ticket hitsRetrieve 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.awaitclient.get_ticket_hits('aiBzfnJlYWN0LWZpcmViYXNlLWF1dGhlbnRpYy1lNGU3NHIdCxIHY2hhbm5lbBiwhAUMCxIGdGlja2V0GPODDAyiAQpwcm9kdWN0aW9u')