Mastodon Mastodon - JIRA and Python
 logo
  • Home 
  • Tags 
  • Blog posts 
  1. Home
  2. Blog posts
  3. JIRA and Python

JIRA and Python

Posted on October 17, 2017  (Last modified on July 11, 2024) • 1 min read • 144 words
Tools: Jira   Tools   Python   Dev   Solved  
Tools: Jira   Tools   Python   Dev   Solved  
Share via
Link copied to clipboard

I really came to hating JIRA with a passion. And now I have to create about 350 tickets.

Naturally I don’t do this by hand. But using the JIRA API is kind of … hard, there is a Python library, but usage is rather sparsely documented, and this whole thing is just annoying as hell.

Although when you did it, it’s quite simple. Here’s an example of how to create a ticket with due date and estimate set from a CSV file:

from pprint import pprint, pformat
from getpass import getpass

import jira


def do_shit():
    url = read("JIRA url:")
    username = read("JIRA username:")
    password = getpass("JIRA password:")
    jira_inst = jira.JIRA(url, basic_auth=(username, password))

    test = {
        "project":          {"key": "TEST"},
        "issuetype":        {"name": "Task"},

        "labels":           ["deleteme", "whatisthis"],

        "summary":          "woho",
        "description":      "wohooooo",
        "duedate":          "2017-11-11",

        "timetracking":    {"originalEstimate": "4d"},
    }

    created = jira_inst.create_issues([test])
    pprint(created)


if __name__ == "__main__":
    do_shit()

So simple.

 Install Arch with full disk encryption, btrfs and EFI
CUPS is … weird 
In case you want to follow me

Here are some links. The further to the right, the less active.

           
(c) Axel Bock | Powered by Hinode.
Code copied to clipboard