Python Forum
Python Jira Connectivity - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Python Jira Connectivity (/thread-41792.html)



Python Jira Connectivity - Shyam - Mar-19-2024

Hi Team,

Using Python I have established a connection with Jira and am able to extract data for specific projects,

Please confirm is there any way to extract all the columns from Jira. At present, in my code, I have explicitly called only two columns. Also, please confirm how to get the headers from Jira.


RE: Python Jira Connectivity - Abhishikt - Apr-17-2024

from jira import JIRA

# Establish connection to Jira
options = {
'server': 'https://your-jira-instance.atlassian.net'
}
jira = JIRA(options, basic_auth=('username', 'password'))

# Fetch issues for a specific project
issues = jira.search_issues('project=YOUR_PROJECT_KEY', maxResults=100) # Adjust maxResults as needed

# Print issue keys and their fields
for issue in issues:
print(issue.key)
for field_name in issue.raw['fields']:
field_value = issue.raw['fields'][field_name]
print(f"{field_name}: {field_value}")