我想使用 Python 中的 REST API 克隆 JIRA 中的现有问题,但也想在克隆时更改项目和问题类型。我怎样才能做到这一点?
任何帮助深表感谢。
谢谢!
我想在python中创建一个jira问题.我知道如何设置摘要,问题类型,描述和项目名称,但我找不到如何设置优先级,截止日期,环境和其他字段.
这就是我所知道的:
new_issue = jira.create_issue(project={'key': 'key'}, summary='New issue from jira- python', description='Look into this one', issuetype={'name': 'Bug'})
Run Code Online (Sandbox Code Playgroud)
如何设置其他字段?
我不确定我在这里做错了什么,我希望别人有同样的问题.我没有得到任何错误,我的json匹配Jira的docs和jira-python在线问题都应该是正确的.我的版本是有效的Jira版本.我也可以通过API直接执行此操作,但我们正在重新编写所有内容以通过jira-python来实现清洁/易用性.
这只是完全清除了Jira中的fixVersions字段.
issue=jira.issue("TKT-100")
issue.update(fields={'fixVersions':[{'add': {'name': 'add_me'}},{'remove': {'name': 'remove_me'}}]})
Run Code Online (Sandbox Code Playgroud)
我可以使用issue.add_field_value()向fixVersions添加新版本,但这不起作用,因为我需要在一个请求中添加和删除故障单的历史记录.
issue.add_field_value('fixVersions', {'name': 'add_me'})
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我试图列出具有状态的项目中的所有项目Done or Closed.当我使用高级搜索运行JQL查询时,我得到:项目中的3096个问题.然而,当我用python运行它时,我得到了大约50个问题.
#/usr/bin/python
import jira.client
from jira.client import JIRA
options = {'server': 'http://jira.confluence.no' }
jira = JIRA(options, batch_auth=('admin', 'admin'))
project = jira.projects()
for project in projects:
issues = jira.search_issues('project=JA')
for issue in issues:
if str(issue.fields.status) == 'Done' or str(issue.fields.status) == 'Closed':
print issue
Run Code Online (Sandbox Code Playgroud)
即使状态Done或ClosedJQL查询存在超过3000个问题,我只会遇到50个左右的问题.
可能有限制吗?
更新/修改 JIRA 问题标签时遇到问题。
我已经尝试了 jira 模块文档中的以下两种变体:
issue.update(labels=['AAA', 'BBB'])
Run Code Online (Sandbox Code Playgroud)
或者
issue.fields.labels.append(u'new_text')
issue.update(fields={"labels": issue.fields.labels})
Run Code Online (Sandbox Code Playgroud)
在最后一个示例中,我收到此错误:
JIRAError: JiraError HTTP 400
text: Field 'labels' cannot be set. It is not on the appropriate screen, or unknown.
url: https://jira.XXXXXXXXXX.com/rest/api/2/issue/XXXXXXXX
response text = {"errorMessages":[],"errors":{"labels":"Field 'labels'
cannot be set. It is not on the appropriate screen, or unknown."}}
Run Code Online (Sandbox Code Playgroud)
有人有什么建议吗?
眼镜:
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win32
jira (0.50)
'rest_api_version': u'2'
Run Code Online (Sandbox Code Playgroud) 文档位于:https : //pythonhosted.org/jira/#installation
它说:安装 jira-python 的最简单(也是最好)的方法是通过 pip:
$ pip install jira 这将处理客户端本身以及要求。
当我尝试时,我收到消息:
pip install jira
Collecting jira
Using cached jira-1.0.3-py2.py3-none-any.whl
Collecting six>=1.9.0 (from jira)
Using cached six-1.10.0-py2.py3-none-any.whl
Collecting requests-oauthlib>=0.3.3 (from jira)
Using cached requests_oauthlib-0.6.1-py2.py3-none-any.whl
Collecting requests-toolbelt (from jira)
Using cached requests_toolbelt-0.6.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): requests>=2.6.0 in /Library/Python/2.7/site-packages (from jira)
Collecting tlslite>=0.4.4 (from jira)
Using cached tlslite-0.4.9.tar.gz
Collecting oauthlib>=0.6.2 (from requests-oauthlib>=0.3.3->jira)
Using cached oauthlib-1.0.3.tar.gz
Installing collected packages: six, oauthlib, requests-oauthlib, requests-toolbelt, tlslite, jira
Found existing …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 python 查询和拉取更改日志详细信息。
下面的代码返回项目中的问题列表。
issued = jira.search_issues('project= proj_a', maxResults=5)
for issue in issued:
print(issue)
Run Code Online (Sandbox Code Playgroud)
我正在尝试传递在上述问题中获得的值
issues = jira.issue(issue,expand='changelog')
changelog = issues.changelog
projects = jira.project(project)
Run Code Online (Sandbox Code Playgroud)
尝试上述操作时出现以下错误:
JIRAError: JiraError HTTP 404 url: https://abc.atlassian.net/rest/api/2/issue/issue?expand=changelog
text: Issue does not exist or you do not have permission to see it.
Run Code Online (Sandbox Code Playgroud)
任何人都可以就我哪里出错或我需要什么权限提出建议。
请注意,如果我issue_id在上面的代码中传递一个特定的,它工作得很好,但我试图传递一个列表issue_id