import xml.etree.ElementTree as ET
import requests
import getpass
# Jira authentication
jira_username = ""
jira_api_key = getpass.getpass("E")
jira_project_key = ""
# Parse XML report
tree = ET.parse('/home/mahiratechnology/Videos/Mccain-Jira/report.xml')
root = tree.getroot()
# Loop through the XML elements and create a Jira issue for each one
for element in root:
# Get the summary and description for the issue from the XML element
summary = element.find('summary').text
description = element.find('description').text
# Create the Jira issue payload
issue_data = {
"fields": {
"project": {"key": jira_project_key},
"summary": summary,
"description": description,
"issuetype": {"name": "Task"}, # Set the issue type to Task
"assignee": {"name": jira_username}
}
}
# Send the request to create the Jira issue
response = requests.post(jira_api_url, json=issue_data, auth=(jira_username, jira_api_key))
# Print the response to the console
print(response.json())
my error : {'errorMessages': ['You do not have permission to create issues in this project.'], 'errors': {}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.