Error: Object of type User is not JSON serializable while creating issue with jira-python

Error: Object of type User is not JSON serializable while creating issue with jira-python

我是 jira 和 python 的新手,我正在尝试通过 jira-python 创建问题并收到此错误:

TypeError: Object of type User is not JSON serializable

我已经尝试删除一些字段,但我仍然遇到同样的错误并且不知道我做错了什么。我能够从现有问题中检索所有这些字段。

我知道有很多类似的问题,但 none 真的很有帮助

这是我的代码:

 python
chapeauId='XXXXX'
jiraChapeau= jira.issue(chapeauId)
summary = "socle serveur pour le projet d'automatisation"
description ="Une description regroupant les paramètres du socle"
issueType="T-065"
priority='Mineur'
zoneReseau='XXXXXXX'
cPT= jiraChapeau.fields.reporter

 issueDict={ 
   'project': {'key': "AB-01"},
   'parent': chapeauId,
   'summary': summary,
   'description': description,
   'priority': priority,
   'issuetype': {'name':issueType},
   'customfield_13034': zoneReseau,
   'customfield_10490' : cPT,

}
newIssue=jira.create_issue(fields=issueDict)

TypeError: Object of type User is not JSON serializable

我假设你在进行身份验证但没有显示出来?这是有关如何创建问题的示例。我的猜测是您的记者价值不起作用,因为这是我看到的唯一与用户相关的东西。我会检查您从 jiraChapeau.fields.reporter 获得的价值。它可能不仅仅是一封电子邮件。你的 'customfield_10490' 是什么?可能不喜欢什么fields.reporter

jira = JIRA(basic_auth=(jira_username, jira_token), options 
= {'server':'https://'+jira_domain+'.atlassian.net'})

issue_dict = {
  'project' : {'key':'ITS'},
  'summary' : 'Store JIRA Backup',
  'assignee': {'name': 'user_email_address_goes_here'},
  'issuetype': {'name':'Service Request'},
  'description': 'Create and download the JIRA backup and store on S: Drive (until 
   another location for cloud storage backups is determined)',
  'components': [{'name': 'JIRA'}],
}
jira.create_issue(issue_dict)