JIRA REST Client for Python - Atlassian Summit 2012

Preview:

Citation preview

Developer Relations, AtlassianBen Speakmon

Breaking free of Java’s velvet chains

JIRA REST Client for Python

(Updated for modern developers)

How can I then return in happy plight,

That am debarr’d the benefit of REST?

Shakespeare (28.1-2)

• Turn JIRA into a service• Integrate it with your other services or script against it

• Handles busywork for you• Autotranslate from JSON to native objects and back

• Authentication, error handling, resource linking

• Support for Python, Java and Ruby

Why use a REST library?

Installation

# Installing from source# Like all good things, it lives on bitbucket$ git clone https://bitbucket.org/ bspeakmon_atlassian/jira-python.git

# Manages dependencies and script installation# for you$ pip install jira-python

Examples

from jira.client import JIRA

options = { 'server': 'https://jira.atlassian.com'}jira = JIRA(options)

# Get an issue.issue = jira.issue('JRA-1330')

# Find all comments made by Atlassians on this issue.import reatl_comments = \ [comment for comment in issue.fields.comment.comments if re.search( r'@atlassian.com$', comment.author.emailAddress)]

# Update the assignee on an issue...jira.assign_issue(issue, 'connie')

# ...or by editing the issue directlyissue.update(assignee='connie')

# Add a comment to an issuejira.add_comment(issue, 'New comment body')

# Delete an issueissue.delete()

jirashell

• Treat your JIRA server like any other Python object• Explore your issues, comments, workflows,

components as first-class resources• Develop and test your scripts against your actual

server• Test in production against real data

• Test bugfixes on staging

An interactive JIRA shell (!)

• http://readthedocs.org/docs/jira-python/• BSD licensed• Pull requests already accepted

Want to play along?

#atlassiansummit

Use Python to turn your JIRA server into a powerful

web service! http://atlss.in/jira-python

Thank you!

Recommended