gpt4 book ai didi

python - 使用 Python 在 JIRA 中使用受让人、观察者和附件创建新问题

转载 作者:太空宇宙 更新时间:2023-11-03 21:38:43 25 4
gpt4 key购买 nike

我正在尝试使用 python 和下面的代码在 JIRA 中创建一个新问题,该代码可以工作,但不知何故无法弄清楚,如何在此处添加附件以及受让人和观察者。另外,在描述中如何添加格式化描述而不是仅添加文本。

有人可以帮忙吗?

 def new_issue(self):
my_date = datetime.datetime.now().date()
# current_day = datetime.datetime.now().day
# current_month = datetime.datetime.now().month
# current_year = datetime.datetime.now().year

now = datetime.datetime.now().date()
start_month = datetime.datetime(now.year, now.month, 1)
date_on_next_month = start_month + datetime.timedelta(35)
start_next_month = datetime.datetime(date_on_next_month.year, date_on_next_month.month, 1)
last_day_month = start_next_month - datetime.timedelta(1)
sixth_day_month = last_day_month.date() + timedelta(6)

description = "Hi Team" \
"Hope you are doing well." \
"Kindly confirm the current advertisers and accounts from the PDF attached." \
"Making sure that for each platform the correct account id, " \
"advertiser or account name get included in the NDP data for ALL channels." \
"Note: Do let us know if there is any account that needs to be removed." \
"Please make sure that the media plan is uploaded on the NeoSageCentral SharePoint Folder."\
"" \
"Thanks,"

issue_dict = {
'project': {'key': 'MOS'},
'issuetype': {'name': 'Reporting'},
'summary': 'Test NDP Data Audit {} AUS'.format(my_date.strftime('%B')),
'description': description,
'customfield_10038': {'value': 'AUS'},
'customfield_10052': {'value': 'Ad hoc'},
'customfield_10053': {'value': 'Monthly'},
'duedate': str(sixth_day_month)}

new_issue = self.client.create_issue(fields=issue_dict, prefetch=True)

最佳答案

您可以通过将 Jira 格式作为文本的一部分来格式化它。因此,如果您想说“您好,我是会计部门的 Joe”,并且在 Jira 中您希望“会计”加粗,只需使用 Jira 格式“会计

这显示了如何添加附件:https://confluence.atlassian.com/jirakb/how-to-add-an-attachment-to-a-jira-issue-using-rest-api-699957734.html

curl -D- -u {username}:{password} -X POST -H "X-Atlassian-Token: nocheck" -F "file=@{path/to/file}" http://{base-url}/rest/api/2/issue/{issue-key}/attachments

关于python - 使用 Python 在 JIRA 中使用受让人、观察者和附件创建新问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53063652/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com