Last active
March 7, 2017 16:05
-
-
Save hujuu/85028b86998b1b5c7562acfa10d0855e to your computer and use it in GitHub Desktop.
Pythonを使ってJIRAチケット作成 ref: http://qiita.com/hujuu/items/8c27e8f53db54a2a4f69
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install jira |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)#報告者名 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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