Skip to content

Instantly share code, notes, and snippets.

@jazlopez
Created October 5, 2023 20:48
Show Gist options
  • Save jazlopez/af964e6b9593117d813c5e72d25802cf to your computer and use it in GitHub Desktop.
Save jazlopez/af964e6b9593117d813c5e72d25802cf to your computer and use it in GitHub Desktop.
Crate JIRA Issue Python
import os
from jira import JIRA
auth = {
'url': 'https://jira.amer.thermo.com/',
'user': os.getenv('JIRA_USER', ''),
'password': os.getenv('JIRA_PASSWORD', '')
}
issue_dict = {
'project': {'key': 'DHPB'},
'summary': 'DELETEME-AUTOMATED CREATED ISSUE',
'description': 'DELETEME-AUTOMATED CREATED ISSUE.',
'issuetype': {'name': 'Task'},
}
client = JIRA(auth['url'], auth=(auth['user'], auth['password']), max_retries=0)
issue = client.create_issue(fields=issue_dict)
issue_url = f"{auth['url']}/browse/{issue.key}"
print(f"Generated URL Jira Issue:{issue_url}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment