I've been using jira-python for some time, but always for queries so far. Now I need to create a new issue from a python script - and it's not working for me.
Whatever I do, I get an E405 (method not allowed error). But it is not - repeat not - a permissions problem.
To try and track this down, I sent the POST command using curl
manually. No problem, everything worked and the issue was created.
So, I assumed my code was setting up the arguments for create_issue
incorrectly. I dropped into ipython, enabled pdb, and tried the create_issue()
call. Sure enough, I got an Exception in the jira-python library. Moved up the stack from raise_on_error
and it looked like this:
500 url = self._get_url('issue')
501 r = self._session.post(url, headers={'content-type': 'application/json'}, data=json.dumps(data))
--> 502 raise_on_error(r)
503
504 raw_issue_json = json.loads(r.text)
Did a json.dumps(data)
to recover the actual string being fed in and got:
'{"fields": {"issuetype": {"name": "Bug"}, "summary": "RFU", "project": {"key": "TW"}, "components": [{"name": "A Component"}]}}'
Which I then cut'n'paste directly as the --data
parameter to curl
. And it worked fine.
Which seems to imply that jira-python
is not working (tried it with 0.25 and 0.18).
Nor is it a python version issue (tried it with pythons 2.7, 3.3, 3.4)
My create_issue()
call looks like this:
j.create_issue(project={'key':'TW'}, issuetype={'name':'Bug'}, summary='RFU', components=[{'name':'A Component'}])
All the field values specified are valid (though different than shown here)
WTH am I doing that is so wrong? This functionality can't possibly be broken in the library
I'm working in virtualenv's and here's the output of pip freeze
argparse==1.2.1
ipython==2.1.0
jira==0.25
oauthlib==0.6.3
requests==2.3.0
requests-oauthlib==0.4.1
six==1.7.2
tlslite==0.4.6
wsgiref==0.1.2
Which was set up with a simple pip install ipython jira
command
BTW, if I fetch an existing issue and then call issue.update()
with suitable params, it works fine.
One other item: I'm running Ubuntu 14.04