Jira Python: Syntax error appears when trying to print

喜欢而已 提交于 2019-12-13 09:47:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!