Skip to content

Instantly share code, notes, and snippets.

@hujuu
Last active March 7, 2017 16:05
Show Gist options
  • Save hujuu/85028b86998b1b5c7562acfa10d0855e to your computer and use it in GitHub Desktop.
Save hujuu/85028b86998b1b5c7562acfa10d0855e to your computer and use it in GitHub Desktop.
Pythonを使ってJIRAチケット作成 ref: http://qiita.com/hujuu/items/8c27e8f53db54a2a4f69
pip install jira
from jira import JIRA
jira = JIRA('https://jira.atlassian.com')
issue = jira.issue('JRA-10')
print (issue.fields.project.key)    #プロジェクトキーの取得
print (issue.fields.issuetype.name)    #チケットのタイプ
print (issue.fields.reporter.displayName)#報告者名
from jira import JIRA
from jira.exceptions import JIRAError
options = {'server': '(自分のJIRAのURL)'}
usr = '(ユーザー名)'
pas = '(パスワード)'
try:
jira = JIRA(options=options, basic_auth=(usr, pas))
except JIRAError as e:
if e.status_code == 401:
print ("Login to JIRA failed.")
print ("Login!!")
new_issue = jira.create_issue(
project='(あなたのプロジェクトキー)',
summary= '(要約)',
description= '(説明)',
issuetype={'name': '(チケットタイプ)'},
priority= {'id': '(優先度[1が最高])'},
assignee={'name': '(担当者)'},
components= [{"name": '(コンポーネント)'}],
versions = [{"name": '(バージョン)'}],
labels = ['(ラベル)']
)
print ("Done!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment