Thursday, March 11, 2010

Using the XMLRPC interface of Jira in Python



I just got a Jira project enabled from Computer Services. I wanted to try the XMLRPC interface for this software, which is much like it is for Confluence. After a little experimentation, I was successful creating an issue from a Python script. The trickiness comes from the fact that CS requires some extra fields to be filled in, and figuring out the format was a pain. But the code is prety simple.

Include the xmlrpc Python library


from xmlrpclib import Server

First, you set up the server.


s = Server('https://server.example.com/rpc/xmlrpc')


Then you get your authentication token.

auth = s.jira1.login('username', 'password')
There are a lot of different functions available. You can see some possibilities by browsing the documentation for the plugin here. I will show how to create a new issue in our installation.

newissue = s.jira1.createIssue(auth, {'project': 'ProjectName', 'type': '2',
'summary':'Issue Created via XML-RPC',
'description':'Created with Python client',
'environment':'Python 2.6',
'components':[{'name': 'A Component in the Project', 'id': 'ddddd'}],
'customFieldValues': [{'customfieldId': 'customfield_10012', 'values': ['ddddd']},
{'customfieldId': 'customfield_10012', 'values': ['ddddd'],  'key': '1'},
{'customfieldId': 'customfield_10018', 'values': ['Staff']},
{'customfieldId': 'customfield_10001', 'values': ['John McMellen']}],
})
The custom fields are various ones required by our setup. The correct values can be determined by looking at the source html of the New Issue page in Jira. The 'ddddd' values are 5 digit numbers that represent various things set up in the Jira installation.
This will create a new issue of type 2, a New Feature. Type 1 is a Bug, 3 is a Ticket, 4 is an Improvement, 5 is a User Contact, and 6 is a Task. It returns a hashtable object that represents the Issue, and you can further add comments or modify properties using the other functions of the interface.

Thursday, February 04, 2010

Using the XMLRPC interface of Confluence in Python

I was successful in creating a new page and in posting to the blog in my personal space thanks to some info here. Python comes with everything needed to use the interface. An example script consists of these parts:
from xmlrpclib import Server  s = Server("https://server/rpc/xmlrpc") token = s.confluence1.login("user", "password") 
Now you can use many of the API functions. For instance you can create a page:
newpagedata = {"title":"Python example New Page 2","content":content,"space":"spacekey"} newpage = s.confluence1.storePage(token, newpagedata) 
where "newpagedata" is a dictionary that has at a minimum the keys "title", "content", and "space". You can also update an existing page by getting a reference of it and replacing the content.
page = s.confluence1.getPage(token, "spacekey", "Python example New Page") page["content"] = "Updated text" page = s.confluence1.storePage(token, page) 
The same process works basically the same way for blog posts, except the functions are "storeBlogEntry" and "getBlogEntry" if you know the ID, or "getBlogEntryByDayAndTitle" if you know that.
Many more functions are available at the link above.

Friday, January 15, 2010

Fixed broken links on the blog

I fixed some broken download links in the blog posts for SPLAT Win32 and some other software. I had retired a server that the files were hosted on and forgot to migrate them until someone pointed out the links didn't work.

Thursday, January 14, 2010

New Graphical Interface for SPLAT 1.3 (Win32)

Austin Wright (VE3NCQ) has been working on a new graphical interface for the Windows port of SPLAT v1.3. The new interface lets you specify the command line parameters in a more friendly way for those of you who don't like typing. You can check it out on his site.

You can find the creator of SPLAT, John Magliacane,  here.

Wednesday, July 22, 2009

Another SPLAT port available for Windows

I haven't been able to keep up with the SPLAT development for a while now. Fortunately, another ham (VE3NCQ) has been working on it too. I would like to thank Austin Wright for helping to keep this valuable tool available for as many as possible. Ain't Open Source great!

Tuesday, August 26, 2008

SPLAT! 1.2.3 for Windows available

Sorry I haven't gotten this out the door sooner. SPLAT! 1.2.3 from John Magliacane has some bug fixes and accuracy improvements. More info is in the documentation. One feature that someone on the blog requested was the ability to save the GnuPlot temp files for post processing (re-scaling, etc.). This is the new -gpsav option.

Please let me know if you have any problems. If you are wondering what SPLAT! is, see this previous post.


http://people.missouristate.edu/jmcmellen/software/splat-1.2.3-win32.zip

Thursday, June 05, 2008

SPLAT! 1.2.2 for Windows is ready

I ran into some problems caused by the compiler trying to "optimize" some of the math routines, so after a lot of troubleshooting, I lowered the optimization level to -O1. Version 1.2.2 for Windows is ready to use. Please let me know if you have any problems. If you are wondering what SPLAT! is, see this previous post.

http://people.missouristate.edu/jmcmellen/software/splat-1.2.2-win32.zip