我是jira-python的新手。我试图在jira管理上自动化一段时间,在创建问题上被阻止了很长时间,与jira-python官方文档一起使用。 我对create_issue()方法的createmeta感到困惑。经过反复试验,我遇到了一个奇怪的http 400错误,然后是一个带有本地地址的网址。
操作系统,Windows 10。
Anaconda中的Spyder IDE(安装了Python 3.5的最新版本)
jira-python,1.0.7
部署了定制的JIRA上有几个“项目”,我对项目''ZXQ'很感兴趣,我用'Project','Issue Type','Summary'手动创建了一个问题,需要'优先级'(这是我在stackoverflow上的第一篇文章,我没有上传pic的权限。)。
以下是整齐的代码,错误消息和createmeta。
phpenv()
控制台中from jira import JIRA
authedjira = JIRA(server = 'http://xxx.xx.xx.xxx:48082',
basic_auth = ('username', 'password'))
issue_dict = {
'project': {'key': 'ZXQ'},
'summary': 'New issue from jira-python',
'description': 'Look into this one',
'issuetype': {'name': 'Bug'}
# 'priority' : '0-Blocked'
}
new_issue = authedjira.create_issue(fields=issue_dict)
jiraerror-jjcv0rwp.tmp中的内容:
runfile('.../Spyder/test/tcreateissue.py', wdir='.../Spyder/test')
Traceback (most recent call last):
File "<ipython-input-15-16266e46b0c1>", line 1, in <module>
runfile('.../Spyder/test/tcreateissue.py', wdir='.../Spyder/test')
File "C:\App\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 714, in runfile
execfile(filename, namespace)
File "C:\App\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 89, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File ".../Spyder/test/tcreateissue.py", line 21, in <module>
new_issue = authedjira.create_issue(fields=issue_dict)
File "C:\App\Anaconda3\lib\site-packages\jira\client.py", line 897, in create_issue
r = self._session.post(url, data=json.dumps(data))
File "C:\App\Anaconda3\lib\site-packages\jira\resilientsession.py", line 152, in post
return self.__verb('POST', url, **kwargs)
File "C:\App\Anaconda3\lib\site-packages\jira\resilientsession.py", line 145, in __verb
raise_on_error(response, verb=verb, **kwargs)
File "C:\App\Anaconda3\lib\site-packages\jira\resilientsession.py", line 55, in raise_on_error
r.status_code, error, r.url, request=request, response=r, **kwargs)
JIRAError: JiraError HTTP 400 url: http://xxx.xx.xx.xxx:48082/rest/api/2/issue details: C:\Users\ABSmi\AppData\Local\Temp\jiraerror-jjcv0rwp.tmp
response headers = {'Vary': 'User-Agent', 'Content-Encoding': 'gzip', 'X-Seraph-LoginReason': 'OK', 'X-AREQUESTID': '1024x353617x1', 'Transfer-Encoding': 'chunked', 'Date': 'Sun, 31 Jul 2016 09:04:51 GMT', 'Server': 'Apache-Coyote/1.1', 'X-ASESSIONID': 'sen5dn', 'X-Content-Type-Options': 'nosniff', 'Connection': 'close', 'X-AUSERNAME': 'zhaoya', 'X-ASEN': 'SEN-5285313', 'Content-Type': 'application/json;charset=UTF-8', 'Cache-Control': 'no-cache, no-store, no-transform'}
response text = {"errorMessages":[],"errors":{"description":"Field 'description' cannot be set. It is not on the appropriate screen, or unknown."}}
答案 0 :(得分:0)
错误详细信息是:
Field 'description' cannot be set. It is not on the appropriate screen, or unknown.
如果您在JIRA中转到项目的项目设置并单击屏幕,那么您可以检查相关的屏幕方案与您的项目。屏幕方案列出了每个问题操作(创建,编辑,查看)使用的屏幕。您的创建屏幕不包含 description 字段,但您确实尝试在创建请求的正文中设置它。这就是你得到400错误的原因。
您有几个选择: