Redson
Redson

Reputation: 2140

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. 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. 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?

Upvotes: 1

Views: 1204

Answers (1)

Steve Barnes
Steve Barnes

Reputation: 28405

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.

Upvotes: 1

Related Questions