Using Python to Build a Jazz Widget – Part 1

I have been spending the past couple of weeks wondering about what I would write about next.  As a manager, I don’t get a lot of time to dig into the deep technical issues like I used to, and I miss that.  So I had some spare time on my hands, and I wanted to do something different that would help me learn something, and also be useful.  I am picking up Python, so I figured that something useful in Python would be good.

As always, the code in this post is derived from examples from as well as the blog posts I mention. The usage of code from that example source code is governed by this license. Therefore this code is governed by this license, which basically means you can use it for internal usage, but not sell it. Remember that this code comes with the usual lack of promise or guarantee. I did all of this against a v4.0.2. RTC instance.  So read on, and feel free to try this out for yourself.

The Problem and the Approach

One of my big issues as a manager is getting the story of my team across to our stakeholders.  I have widgets which show the state of our significant stories and epics, but my stakeholders are not all technical types, and sometimes they need something a bit more graphic.  The presentation needs to have some color, and some interesting graphics.  I didn’t want to fool around with BIRT, because I might have some custom calculations, and some custom icons that I want to use.  I also don’t want to have to upgrade the report when my tools get upgraded.  So I thought that I could create a Python script that would use OSLC to get the information that I need.  I can then take this information, and create a small HTML page with the information and links that I want to show.  Using the new External Content widget (see my earlier post on Management by Results), I can then display this content on a dashboard.  If I set up a cron job on my machine to run every six hours, I will not put an undue burden on the Jazz infrastructure, and I will give my stakeholders a nice dashboard view of what they want to see.

So this solves my reporting issue, allows me to learn Python, allows me to get deeper into OSLC, and should meet the needs of my stakeholders.  Time to get to work!

Figuring it Out

So since I am a Python newbie, I decided to do what I always do when starting with something new.  Do a web search for using Python with OSLC, and try to borrow as much code as possible from others who may have done this before.  Why reinvent the wheel?  I did see some good blogs on using Python and OSLC with RQM, easy authenticating with Python, as well as some OSLC with Python posts on the Jazz forums.

My First Sample Program

The blog posts were a good place to start, since everything begins with authentication.  So the first thing I did was to download and install the requests library by Kenneth Reitz that was mentioned in the easy authentication with Python blog post.  Since I am running Ubuntu, I just needed to make sure that I had the Python pip module installed.  I then downloaded the requests library,  Then I did a quick “sudo pip install requests”, and BLAM, the whole thing was all set.  My Python environment was set, now to try a quick sample program.

So I just want to get into the repository, authenticate, and see if I can get ONE single resource out of the repository.  No luck.  I keep having authentication issues.  So the next thing that I go and look at is the first blog that I listed, using Python and OSLC with RQM, and use the JazzClient class defined there.  I really like how simple it makes the main program read.  Still no luck.  As I look through the responses that I am getting back, I notice that I am hitting https://jazzserver:9443/ccm, and when I go and look at the Jazz repository the base URI is https://jazzserver:9443/rtc.  Looks like I have been hitting the wrong spot!!  Once I change that to the correct address, and add a second storage of the appropriate cokkies as described in a Jazz forum post, everything begins to work.

Now most of this code is “borrowed” from the blogs that I referenced earlier, but you can find the code out on JazzHub.  You can find my project on JazzHub, under the title “Python Jazz Client“.  Check out the and files.  You can use them, but you will need to change the user, password and base URI in the main module.  Your base URI will probably look like “”.

This Python Jazz Client project on JazzHub is interesting, as it is the first real “development” that I have ever done on JazzHub.  I made it a public project, so if you are interested in this type of work, or you have suggestions for expanding this JazzClient class, please join the project and pitch in.  I can honestly use all of the help that I can get.


So there it is, a bunch of Python code that helped me get more comfortable with Python, utilized OSLC, and gets through authentication and can pull information on individual work items.  It was so easy that even a slow-witted manager like me was able to do it.  Next I will begin to build on these basic capabilities, to pull specific information from work items, and then use this to create some simple HTML presentations of the data.

6 thoughts on “Using Python to Build a Jazz Widget – Part 1

    1. Not sure what resource you are referring to here. This post is almost 6 years old, so I would imagine that things have changed a little bit since I originally wrote this article. I’m sorry, but I am no longer focused in this space, so I can’t really help you out here.

      1. Swetha

        Thanks for letting me know. Actually I’m trying to extract details from RQM via Python code. So, I wanted to know how you had coded. But thanks anyway!

  1. Swetha

    It says projects are now toolchains, but i couldn’t find your project file there as well. Could you post it out anywhere so that it could be of help. I’m a beginner at Python also with RQM. So needed some reference to start with. Thanks in advance! 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.