如何使用python和XML-RPC获取Bugzilla的注释和附件详细信息?

时间:2015-01-09 18:51:44

标签: python xml-rpc bugzilla

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

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

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

我不知道如何得到其余的评论。此外,我不知道如何访问带有错误的附件。谁能帮我这个?此软件包是否支持评论和下载附件?

1 个答案:

答案 0 :(得分:1)

您可以通过以下方式获得评论:

for comment in bug.comments:
   print comment

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