I am now maintaining a python library (originally written by Jeff Balogh) for interacting with Bugzilla via the the REST API. You can get it from:


Check out the README for a simple example of how to use the library. You can also take a look at the scripts at http://hg.mozilla.org/users/clegnitto_mozilla.com/release_tools for some more advanced uses.

Some features:

  • Supports authentication (with credentials stored in the system keychain with a config file fallback)
  • Supports querying the API via agents with optional query options, so you can include/exclude what you need
  • Support for Bugs, Users, Attachments, Comments, Changes, Changesets, Flags, Keyword. Dependency support will be working shortly as well
  • Supports common set and equality operations for objects. For example, looping through a list of Bug objects:
    for bug in buglist:
      print bug

    Checking if a Bug object is in a list of Bugs:

    if bug in buglist:
      print "Found!"

    Adding sets of bugs together into one large set:

    all_bugs = buglist1 + buglist2 + buglist3

    Checking if two User objects are the same:

    if bug.assigned_to == bug.reporter:
      print "Assigned to the reporter!"

The library has really cleaned up my scripts and has been insanely useful. Thanks to Jeff for creating such a nice library and letting me take it over and improve it.

Tagged with:  

2 Responses to Python library for Bugzilla’s REST API

  1. This sounds awesome! Could you link it from http://wiki.mozilla.org/Bugzilla:Addons ? I think there’s probably an appropriate section for it.