This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Access Bugzilla’s XML-RPC API asyncronously (non-blocking) using the Twisted framework.

Simple Example: Fetching a bug

from txbugzilla import connect, BugzillaException
from twisted.internet import defer, reactor

@defer.inlineCallbacks
def example():
    # connect() defaults to https://bugzilla.redhat.com/xmlrpc.cgi
    bz = yield connect()

    # fetch a bug
    try:
        bug = yield bz.get_bug_simple(10000)
        print(bug.summary)
    except BugzillaException as e:
        print(e)

if __name__ == '__main__':
    example().addCallback(lambda ign: reactor.stop())
    reactor.run()

Example: Authentication

By default, connections to Bugzilla are anonymous, so you cannot do fun things like update bugs or view private bugs or private information. If you wish to authenticate your connection to Bugzilla, you can pass a username and password to connect(). The deferred that connect() returns will fire a callback when the authentication succeeds.

from txbugzilla import connect
from twisted.internet import defer

@defer.inlineCallbacks
def example():
    # Authenticate via username and password
    bz = yield connect(username='user@example.com', password='foo')

    # Do something as this logged-in username, for example:
    # bug = yield bz.getbugsimple(...)

Example: Re-using Authentication token

Authenticating to Bugzilla with a username and password involves one XML-RPC roundtrip during connect() in order to obtain a token and use that token on subsequent actions.

If you’ve already authenticated one time, you can save the token offline and re-use it when your program runs again.

from txbugzilla import connect
from twisted.internet import defer

@defer.inlineCallbacks
def example():
    # Authenticate via username and password
    bz = yield connect(username='user@example.com', password='foo')

    # Save bz.token to a file or database to reuse it later and avoid
    # having to re-authenticate.
    print(bz.token)
    # prints "123456-abcdef987"

And then, to re-use this token later:

from txbugzilla import Connection
from twisted.internet import defer

@defer.inlineCallbacks
def some_time_later():
    # Re-connect using that saved token
    bz = Connection(username='user@example.com', token='123456-abcdef987')

    # Do something as this logged-in username, for example assign a bug
    # to someone:
    yield bz.assign(1234, 'someone@redhat.com')

Side note: ~/.bugzillatoken

If you pass no parameters to connect(), the resulting connection will be anonymous unless you have a special .bugzillatoken file in your home directory. This file should look something like this:

$ cat ~/.bugzillatoken
[bugzilla.redhat.com]
token = 123456-abcdef987

txbugzilla will look for this file and attempt to use the token there if one exists.

To construct this .bugzillatoken file, you can use the python-bugzilla module, like so:

$ pip install python-bugzilla
$ bugzilla login
Bugzilla Username: user@example.com
Bugzilla Password: **********
Login successful.

Example: Assigning bugs

This will definitely earn you friends.

from txbugzilla import connect
from twisted.internet import defer

@defer.inlineCallbacks
def example():
    bz = yield connect(username='user@example.com', password='foo')

    try:
        result = yield bz.assign(1234, 'someone@redhat.com')
        if result:
           print('assigned bz #1234 to someone@redhat.com')
        else:
           print('bz #1234 is already assigned to someone@redhat.com')
    except BugzillaException as e:
        print(e)

Example: Raw XML-RPC calls

Want to make some API call not mentioned here? Use the call() method to make raw XML-RPC calls. It will take care of token authentication for you, too.

For example, to see a list of all the groups of which you are a member:

from txbugzilla import connect
from twisted.internet import defer
from pprint import pprint

@defer.inlineCallbacks
def example():
    bz = yield connect(username='user@example.com', password='foo')

    try:
        result = yield bz.call('User.get', {'names': [bz.username],
                                            'include_fields': ['groups']})
        pprint(result['users'][0]['groups'])
    except BugzillaException as e:
        print(e)
Release History

Release History

1.0.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
txbugzilla-1.0.1.tar.gz (6.2 kB) Copy SHA256 Checksum SHA256 Source Jun 19, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting