简体   繁体   English

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

[英]How do I get the comments and attachment details for Bugzilla using python and XML-RPC?

I am writing a python script using the python-bugzilla 1.1.0 pypi. 我正在使用python-bugzilla 1.1.0 pypi编写python脚本。 I am having a hard time trying to get some of the tags (some may not be supported with the package) from a bug on Bugzilla. 我很难从Bugzilla上的错误中获取一些标签(该软件包可能不支持某些标签)。 Here is the code I have so far: 这是我到目前为止的代码:

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

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

I don't know how to get the rest of the comments. 我不知道如何获得其余评论。 Also I don;t know how the get access to an attached file with the bug as well. 我也不知道该如何访问带有错误的附件。 Can anyone help me with this? 谁能帮我这个? Are comments and downloading attached file not supported with this package? 此程序包不支持注释和下载附件吗?

You can get the comments with: 您可以通过以下方式获得评论:

for comment in bug.comments:
   print comment

Where comments have links you can download them with urllib2, scapy or some such and where there is an attachment you can get the ID from the comment and then use bugzilla.openattachment(ID) to get it. 注释包含链接的位置,您可以使用urllib2,scapy或类似工具下载它们;如果有附件,则可以从注释中获取ID,然后使用bugzilla.openattachment(ID)进行获取。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM