问题
from jira.client import jira
options = {'server': 'https://URL.com'}
jira = JIRA(options, basic_auth=('username', 'password'))
issues = jira.search_issues('jqlquery')
for issue in issues:
print issue
I want to print the output of the jql query.However, getting syntax error on the last line "issue".
回答1:
The way to print the issue keys to your command prompt is:
from jira.client import jira
options = {'server': 'https://URL.com'}
jira = JIRA(options, basic_auth=('username', 'password'))
issues = jira.search_issues('jqlquery')
for issue in issues:
print issue
That will do it. However, you mention you get a syntax error for your JQL query, so you'll need to post that query to see what is wrong with it. Valid would be, for example if you want to find the issues you added label 'TEST' to in your previous question:
label = 'TEST'
issues = jira.search_issues('labels=' + str(label))
Or:
jqlquery = 'labels=TEST'
issues = jira.search_issues(jqlquery)
来源:https://stackoverflow.com/questions/27287642/jira-python-syntax-error-appears-when-trying-to-print