Wiki

Case Status Kiln
Register Log In

Wiki

 
Recipe Conventions
  • RSS Feed

Last modified on 9/30/2011 2:57 PM by User.

Tags:

Recipe Conventions

Each of our Python recipes use a set of common conventions.

  • We use Python and FogBugzPy. See the Quick Start Guide or Installing Python and FogBugzPy.
  • We use an fbSettings file to store the FogBugz URL and token. See Storing Configuration Settings in fbSettings.py
  • An explanation of the script and how to use it is in a docstring (triple-quoted text) at the top of the file.
  • Variables that you need to edit to be specific to your situation are variables, e.g. IX_PERSON_UP_FOR_GRABS, right below the documentation text. Replace the values of these variables to match your situation.

Here's an example:

example.py

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
'''
Example

This script prints 10 cases assigned to a specified user.

To run this script:
1. Edit the IX_PERSON value to match the person you want to find cases for
2. Run this script using:
   > python example.py

See https://developers.fogbugz.com/default.asp?W194 for more
information on using the FogBugz XML API with Python.
'''
IX_PERSON_TO_SEARCH = 2 # The ixPerson value of the person you want
                        # to find cases for

from fogbugz import FogBugz
import fbSettings

fb = FogBugz(fbSettings.URL, fbSettings.TOKEN)

resp = fb.search(q='assignedto:"=%s"' % IX_PERSON_TO_SEARCH,
                 cols='sTitle',
                 max=10)
for case in resp.cases.findAll('case'):
    ixBug = int(case['ixbug'])
    sTitle = case.stitle.string.encode('UTF-8')
    print "%s: %s" % (ixBug, sTitle)