Models and scripts to access the Bugzilla REST API.
Python
Pull request Compare This branch is 19 commits ahead of jbalogh:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
bugzilla Add support for the update token Jan 6, 2012
scripts Support setting the API URL and user/pass in the environment Jan 3, 2011
LICENSE a very slow bzattach using the rest api Nov 20, 2009
MANIFEST.in
README.rst
requirements.txt Point people at my repo until https://github.com/sixapart/remoteobjec… Dec 2, 2010
setup.py Add an example ot the readme Dec 27, 2010

README.rst

This package defines remoteobjects models and some scripts for all the resources provided in Gervase Markham's Bugzilla REST API. Right now it's pretty damn slow. I hope that will change.

Installation

Currently, this package depends on a pre-release version of remoteobjects, so we'll have to do this the long way.

  1. Check out the code:

    git clone git://github.com/LegNeato/bztools.git
    
  2. (optional) Create your virtualenv using virtualenvwrapper:

    mkvirtualenv --no-site-packages bztools
    
  3. Install pip:

    easy_install pip
    
  4. Install the dependencies for bztools:

    pip install -r requirements.txt
    
  5. Run setup.py so the scripts are installed to your bin directory:

    python setup.py install
    

Now you'll have bzattach installed in the /bin directory of your virtual environment. To use the script, you'll have to activate this environment with workon bztools.

Usage

Example:

from bugzilla.agents import BMOAgent
from bugzilla.utils import get_credentials

# We can use "None" for both instead to not authenticate
username, password = get_credentials()

# Load our agent for BMO
bmo = BMOAgent(username, password)

# Set whatever REST API options we want
options = {
    'changed_after':    '2010-12-24',
    'changed_before':   '2010-12-26',
    'changed_field':    'status',
    'changed_field_to': 'RESOLVED',
    'product':          'Core,Firefox',
    'resolution':       'FIXED',
    'include_fields':   '_default,attachments',
}

# Get the bugs from the api
buglist = bmo.get_bug_list(options)

print "Found %s bugs" % (len(buglist))

for bug in buglist:
    print bug