Add example JQL

This commit is contained in:
2025-05-09 11:17:15 +02:00
parent 0d8523bdcc
commit b094b2b5bc
+14 -1
View File
@@ -18,4 +18,17 @@ user = jira.username
if user:
print(f'Connected to JIRA as: {user}')
else:
print('Failed to connect to JIRA')
print('Failed to connect to JIRA')
# Define a JQL query to fetch one JIRA ticket
jql_query = 'created >= -30d order by created DESC' # Adjust the JQL query as needed
max_results = 1 # Limit the results to one ticket
# Fetch the ticket(s) using the JQL query
tickets = jira.jql(jql_query, limit=max_results)
if tickets and tickets.get('issues'):
ticket = tickets['issues'][0]
print(f"Fetched JIRA ticket: {ticket['key']} - {ticket['fields']['summary']}")
else:
print('No tickets found or failed to fetch tickets')