【问题标题】:How do I get the comments and attachment details for Bugzilla using python and XML-RPC?如何使用 python 和 XML-RPC 获取 Bugzilla 的评论和附件详细信息?
【发布时间】:2015-01-09 18:51:44
【问题描述】:

我正在使用 python-bugzilla 1.1.0 pypi 编写一个 python 脚本。我很难从 Bugzilla 上的错误中获取一些标签(一些可能不受软件包支持)。这是我到目前为止的代码:

bz = bugzilla.Bugzilla(url='https://bugzilla.redhat.com/xmlrpc.cgi')
bug = bz.getbug(495561)

print bug.description         #this works (it's the first comment)

我不知道如何获得其余的 cmets。我也不知道如何访问带有错误的附件。谁能帮我这个?这个包不支持cmets和下载附件吗?

【问题讨论】:

  • 试试:print dir(bug) 它会告诉你它有什么属性。 help(bug) 也应该很有用。
  • @SteveBarnes 感谢您的帮助,所以似乎无法做我想做的事

标签: python xml-rpc bugzilla


【解决方案1】:

您可以通过以下方式获得 cmets:

for comment in bug.comments:
   print comment

如果 cmets 有链接,您可以使用 urllib2、scapy 等下载它们,如果有附件,您可以从评论中获取 ID,然后使用 bugzilla.openattachment(ID) 获取它。

【讨论】:

  • 我收到以下错误:Traceback (most recent call last): File "hello.py", line 132, in <module> downloadFile = bugzilla.openattachment(2080); AttributeError: 'module' object has no attribute 'openattachment'
  • 会不会是因为我使用的是Bugzilla 4.2.5?
  • 我在 Linux 机器上,bugzilla 告诉我它是 1.1.0 版 - 今晚使用 pip install python_bugzilla 安装。试试bugzilla.Bugzilla42.openattachment
  • bugzilla-python 包的版本是1.1.0。我问的是 Bugzilla 本身的版本
猜你喜欢
  • 2014-04-20
  • 1970-01-01
  • 2012-02-05
  • 1970-01-01
  • 1970-01-01
  • 2012-08-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多