python - 为 Jira 创建问题时出现 Suds 错误

标签 python soap jira suds

每次尝试向 Jira 发送问题时,我都会收到以下错误:

suds.WebFault: Server raised fault: 'org.xml.sax.SAXException: 
   Found character data inside an array element while deserializing'

我在 stackoverflow 和网络上搜索答案,有些人说这是 suds 0.3 < 错误。但我使用的是0.4.1.1版本。

这是我的问题字典:

  issue = {"assignee": "user_test",
             "components": "17311",
             "project": "TES",
             "description" : "This is a test",
             "priority" : "Major",
             "summary" : "Just a test title",
             "type":"Incident"
             }

我制作的 Jira 类:

  def create_issue(self,issue):
        if(not isinstance(issue,dict)):
            raise Exception("Issue must be a dict")

        new_issue = self.jira.service.createIssue(in0 = self.auth,in1 = issue)

        return new_issue["key"]

最佳答案

使用 jira-python 我可以添加类似的组件:

jira.create_issue(project={'key': project_id}, summary=ticket_summary,
                                 description=ticket_description, issuetype={'name': ticket_issue_type},
                                 components=[{'name': 'Application Slow'},], parent={'id': new_issue_key}, customfield_10101=termination_change_date,
                                 )

我一直尝试以“components={'name': 'Application Slow'}”的形式发送组件,但收到“数据不是数组”(或类似的消息)。我查看了 REST API 以及它们的一些数组示例是如何组成的,这就是我如何得出上面的示例。

https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Create+Issue#JIRARESTAPIExample-CreateIssue-Request

Labels
"customfield_10006": ["examplelabelnumber1", "examplelabelnumber2"]
Labels are arrays of strings

我知道这有点偏离主题,但是当我搜索我的问题时,我发现自己经常回到这里,所以我希望这对您的案例和其他人有一点帮助。概念与 Components 字段相同,仅接受对象数组。

关于python - 为 Jira 创建问题时出现 Suds 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10871046/

相关文章:

python - JIRA REST API 和 kerberos 身份验证

python - 了解 python3 文档示例代码

perl - 如何更改在 perl 中生成 SOAP::Lite 请求的 xml 元素的顺序?

python - 无法在 python3.5 中安装 hashlib - 错误代码 1

asp.net - 从 jQuery 调用 ASP.NET ASMX Web 服务

java - 如何在 Clojure/Java 中使用 SOAP?

oauth - 在 JIRA 中对 createmeta 的 REST API 调用不会返回项目

jira - Atlassian Connect Express : Credentials rejected at connect-ace. atlassian.net

python - ipython 笔记本服务器设置调试

python - libpython2.7.so.1.0 : cannot open shared object file: No such file or directory