16

JIRA REST Client for Python - Atlassian Summit 2012

Embed Size (px)

Citation preview

Page 1: JIRA REST Client for Python - Atlassian Summit 2012
Page 2: JIRA REST Client for Python - Atlassian Summit 2012

Developer Relations, AtlassianBen Speakmon

Breaking free of Java’s velvet chains

JIRA REST Client for Python

Page 3: JIRA REST Client for Python - Atlassian Summit 2012

(Updated for modern developers)

How can I then return in happy plight,

That am debarr’d the benefit of REST?

Shakespeare (28.1-2)

Page 4: JIRA REST Client for Python - Atlassian Summit 2012

• 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?

Page 5: JIRA REST Client for Python - Atlassian Summit 2012

Installation

Page 6: JIRA REST Client for Python - Atlassian Summit 2012

# 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

Page 7: JIRA REST Client for Python - Atlassian Summit 2012

Examples

Page 8: JIRA REST Client for Python - Atlassian Summit 2012

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)]

Page 9: JIRA REST Client for Python - Atlassian Summit 2012

# 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()

Page 10: JIRA REST Client for Python - Atlassian Summit 2012

jirashell

Page 11: JIRA REST Client for Python - Atlassian Summit 2012

• 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 (!)

Page 12: JIRA REST Client for Python - Atlassian Summit 2012
Page 13: JIRA REST Client for Python - Atlassian Summit 2012
Page 14: JIRA REST Client for Python - Atlassian Summit 2012

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

Want to play along?

Page 15: JIRA REST Client for Python - Atlassian Summit 2012

#atlassiansummit

Use Python to turn your JIRA server into a powerful

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

Page 16: JIRA REST Client for Python - Atlassian Summit 2012

Thank you!