The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JIRA-PYTHON: Pass argument to python script to get Jira static Query/Create a Stout

Austin Karalekas
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 24, 2021

Good day,

 

 So what I'm trying to accomplish is the ability to pass a dynamic query such as:

python staticquery.py project = "TTS" AND assignee="Bob"

To my python script I created and search the above query to get static query. It works if I input it manually in the code, but I want to be able to type it in the command line so I don't have to edit the script every time.

Current Script:

for issue in jira.search_issues("TTS" AND assignee="Bob", maxResults=3):

print('{}: {}'.format(issue.key, issue.fields.summary,))

 

This works fine, as is but would be useful if I could input argument where the query is. I'm also looking for a way to direct the output into a file when ran. So the results of the static query would go into a file and if possible be labeled after date it was created. I'd appreciate any help and see if anyone can come up with ideas.

 

Thank you.

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Mohamed Benziane
Community Champion
September 1, 2021

Hi,

Welcome to the community

Create a .txt file (with your JQL inside) that your python script will read. You will only need to update the .txt file and no your script.