Created
September 2, 2021 14:13
-
-
Save MaximilianMeyer93/05cfe394bc5a776a1195a34c971fab69 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/python | |
from jira.client import JIRA | |
import argparse | |
import jira.client | |
parser = argparse.ArgumentParser(description='Automation Jira cards') | |
parser.add_argument('--key', help='add jira API key') | |
parser.add_argument('--email', help='Your Jira email') | |
parser.add_argument('--server', help='Your server URL', required=True) | |
#parser.add_argument('--issue', help='Name or ID of Issue') | |
#parser.add_argument('--issueType', help='Issue type, e.g Bug') | |
#parser.add_argument('--priority', help='Priority of issue, e.g HIGH') | |
args = parser.parse_args() | |
jira = JIRA(options={'server': args.server}, basic_auth=(args.email, args.key)) | |
projects = jira.projects() | |
jra = jira.project('SAP') | |
print(jra.name) | |
print(jra.lead.displayName) | |
#issue_dict = { | |
# 'project': {'id':u'10328'}, | |
# 'summary': 'New issue from jira-python', | |
# 'description': 'Look into this one', | |
# 'issuetype': {'id':u'10004'}, | |
# 'customfield_10208' : '10478', | |
# 'customfield_10115' : '10312' | |
# } | |
#new_issue = jira.create_issue(fields=issue_dict) | |
new_issue = jira.create_issue(project='10328', summary='New issue from jira-python', description='Look into this one', issuetype={'id': '10004'}) |
tellesnobrega
commented
Sep 2, 2021
#!/usr/bin/python
from jira.client import JIRA
import argparse
import jira.client
parser = argparse.ArgumentParser(description='Automation Jira cards')
parser.add_argument('--key', help='add jira API key')
parser.add_argument('--email', help='Your Jira email')
parser.add_argument('--server', help='Your server URL', required=True)
#parser.add_argument('--issue', help='Name or ID of Issue')
#parser.add_argument('--issueType', help='Issue type, e.g Bug')
#parser.add_argument('--priority', help='Priority of issue, e.g HIGH')
args = parser.parse_args()
jira = JIRA(options={'server': args.server}, basic_auth=(args.email, args.key))
projects = jira.projects()
jra = jira.project('SAP')
print(jra.name)
print(jra.lead.displayName)
issue_dict = {
'project': {'id': '10328'},
'summary': 'New issue from jira-python',
'description': 'Look into this one',
'issuetype': {'name': 'Bug'},
# Acceptable values: Must Fix, Should Fix, Unbreak Now
'customfield_10115': {'value': 'Must Fix'},
'customfield_10208': {'value': 'SPADE'}
}
new_issue = jira.create_issue(fields=issue_dict)
# new_issue = jira.create_issue(project='10328', summary='New issue from jira-python',
# description='Look into this one', issuetype={'name': 'Bug'}, priority={'name': 'Highest'}, fields={'Bug Priority': {'value': 'Must Fix'}})
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment