create_issues documentation is wrong about project field
When creating issues, if one of the issues contain an invalid value for a field, the program quits on an AttributeError.
File "jiracli.py", line 159, in create issues = self.jira.create_issues(field_list=fields['issues']) File "/Users/jangeja/everops/CLIs/jiraCLI/venv/lib/python2.7/site-packages/jira/client.py", line 936, in create_issues r = self._session.post(url, data=json.dumps(data)) File "/Users/jangeja/everops/CLIs/jiraCLI/venv/lib/python2.7/site-packages/jira/resilientsession.py", line 154, in post return self.__verb('POST', url, **kwargs) File "/Users/jangeja/everops/CLIs/jiraCLI/venv/lib/python2.7/site-packages/jira/resilientsession.py", line 147, in __verb raise_on_error(response, verb=verb, **kwargs) File "/Users/jangeja/everops/CLIs/jiraCLI/venv/lib/python2.7/site-packages/jira/resilientsession.py", line 50, in raise_on_error error_list = response['errors'].values() AttributeError: 'list' object has no attribute 'values'
The actual response from the failed create is [{u'status': 400, u'elementErrors': {u'errorMessages': [], u'errors': {u'versions': u"Version name '1.2' is not valid"}}, u'failedElementNumber': 0}]
So its calling .values() on the list object causing it to fail
Any news on this? I have the same problem.
Same problem for me, I was able to reproduce it with this sample of code.
issue_list = [
{
'project': {'name': 'DBG'},
'summary': 'Test GOJIRA',
'description': '',
'issuetype': {'name': 'Evolution'},
}]
issues = jira.create_issues(field_list=issue_list)
Then this is the stack
Traceback (most recent call last):
File ".\update_jira.py", line 25, in <module>
issues = jira.create_issues(field_list=issue_list)
File "D:\Program Files\Python\Python36-32\lib\site-packages\jira\client.py", line 975, in create_issues
r = self._session.post(url, data=json.dumps(data))
File "D:\Program Files\Python\Python36-32\lib\site-packages\jira\resilientsession.py", line 153, in post
return self.__verb('POST', url, **kwargs)
File "D:\Program Files\Python\Python36-32\lib\site-packages\jira\resilientsession.py", line 146, in __verb
raise_on_error(response, verb=verb, **kwargs)
File "D:\Program Files\Python\Python36-32\lib\site-packages\jira\resilientsession.py", line 49, in raise_on_error
error_list = response['errors'].values()
AttributeError: 'list' object has no attribute 'values'
This is not technically a bug, if instead of:
issue_list = [
{
'project': {'name': 'DBG'},
'summary': 'Test GOJIRA',
'description': '',
'issuetype': {'name': 'Evolution'},
}]
you use
issue_list = [
{
'project': 1234,
'summary': 'Test GOJIRA',
'description': '',
'issuetype': {'name': 'Evolution'},
}]
The same example will work. It just requires IDs currently.
@ssbarnea I am not sure if we should just update documentation or update this as an enhancement.
@hdost Please update the documentation and close the bug. For enhancements we welcome anyone to create PRs.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.