我正在写一个Discord机器人。我希望它在Jira中更新错误时发送消息。
这是我到目前为止所拥有的:
url = 'https://webhook.site/#!/4cf42122-bdea-4d0b-a122-82d26c1c34f9/363f047f-df4a-420f-8851-199b02aa2658'
jql = 'project = ABC AND issuetype = Bug and assignee = currentUser()'
encoded_body = json.dumps({
"name": "webhook",
"url": url,
"events": [
"jira:issue_updated"
],
"JQL": jql,
"excludeIssueDetails": False
})
url = '{}/rest/webhooks/1.0/webhook'.format(self.config['jira']['server'])
headers = {'Content-type': 'application/json',
'Accept': 'application/json',
'Content-Encoding': 'utf-8'}
answer = requests.post(url, auth=(self.config['jira']['user'], self.config['jira']['password']), data=encoded_body, headers=headers )
我想找到一个异步函数,该函数可以在触发Webhook时执行。