JIRA-Python: How can I pass user inputs in Jira issue search?

I'm trying to get information based on the input provided by user and then passing it in a function which gives back the issues created. But I'm not able to pass the objects in search_issue query?

def issuecreated(projectname, reportername, datefrom, dateto):
print projectname, reportername, datefrom, dateto
for i in jira.search_issues('project = projectname AND reporter = reportername AND created > datefrom and created < dateto'):
return i

projectname=raw_input("Please give the project name: ")
reportername=raw_input("Please provide the name of creator: ")
datefrom=raw_input("Please provide the time interval for which you want issues: From ")
dateto=raw_input("Please provide the time interval for which you want issues: To ")
print projectname, reportername, datefrom, dateto
issuecreated(projectname, reportername, datefrom, dateto)

 

I'm able to see the inputs in the function by it is not getting passed in jira.search_issues.

Please help.

Thanks!

1 answer

This widget could not be displayed.

Create a string that is made up of the JQL you know and the input from users. Then pass that string to jira.search_issues()

"Static text %s" % variablename

 

Thanks for the input!

I tried to pass the string into jira.search_issues(), but it throws error, jira.exceptions.JIRAError on jira.search_issue() line. Here is what I did.

query = 'project = projectname AND reporter = reportername AND created > datefrom and created < dateto'

for i in jira.search_issues(query):
print i

 

I have given the encoding magic comments to convert Unicode.

It works now, thanks!

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

79 views 1 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you