Git Product home page Git Product logo

fogbugzpy's Introduction

Python FogBugz API Wrapper

This Python API is simply a wrapper around the FogBugz API, with some help from Leonard Richardson's BeautifulSoup (http://www.crummy.com/software/BeautifulSoup/) and the magic of Python's __getattr__().

Getting Started:

To use the FogBugz API, install the package by using pip

$ pip install fogbugz

A Quick Example:

>>> from fogbugz import FogBugz
>>> fb = FogBugz("http://example.fogbugz.com/") # URL is to your FogBugz install
>>> fb.logon("[email protected]", "password")
>>> resp = fb.search(q="assignedto:tyler") # All calls take named parameters, per the API
>>> resp # Responses are BeautifulSoup objects of the response XML.
<response><cases count="2"><case ixbug="1" operations="edit,assign,resolve,email,remind"></case><case ixbug="2" operations="edit,spam,assign,resolve,reply,forward,remind"></case></cases></response>
>>> # You shouldn't need to know too much about BeautifulSoup, but the documentation can be found here:
>>> # http://www.crummy.com/software/BeautifulSoup/documentation.html
>>> for case in resp.cases.childGenerator(): # One way to access the cases
...     print case['ixbug']
...
1
2
>>> for case in resp.findAll('case'): # Another way to access the cases
...     print case['operations']
...
edit,assign,resolve,email,remind
edit,spam,assign,resolve,reply,forward,remind
>>> resp = fb.edit(ixbug=1, sEvent="Edit from the API") # Note the named parameters
>>> resp
<response><case ixbug="1" operations="edit,assign,resolve,email,remind"></case></response>

Note that, per API v5.0, all data between tags, such as the token, is now wrapped in CDATA. BeautifulSoup's implementation of CData generally allows for it to be treated as a string, except for one important case: CData.__str__() (a.k.a. str(CData)) returns the full text, including the CDATA wrapper (e.g. "<![CDATA[foo]]>"). To avoid accidentally including the CDATA tage, use CData.encode('utf-8')

Additional Details:

If your script requires a certain version of the FogBugz API, make sure to pass it as an argument to the constructor. This will protect you from unexpected differences should we make backwards-incompatible changes.

>>> from fogbugz import FogBugz
>>> fb = FogBugz("http://example.fogbugz.com", api_version=5)

For more info on the API: http://help.fogcreek.com/the-fogbugz-api

Much of the API has not been thoroughly tested. Please report bugs to [email protected]

fogbugz_bis is a fork of the FogCreek codebase to support Python 3 and BeautifulSoup 4. You should install/require only one of fogbugz or fogbugz_bis as they both implement the same module.

fogbugzpy's People

Contributors

adomas000 avatar davidhodgson avatar djl605 avatar jaraco avatar lbolla avatar radamsfc avatar skriems avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.