1

I am creating an issue in JIRA as a part of CI/CD using Python 2.1.

Code

from jira.client import JIRA
import requests
import jira.exceptions
import re

jira_options={'server': 'https://jira.com'}

jira=JIRA(options=jira_options,basic_auth=('username','Passwd'))

print "auth success"

issue_dict = {
    'project': {'id': 12345},
    'summary': 'New issue from jira-python',
    'description': 'Look into this one',
    'issuetype': {'name': 'Bug'},
}


new_issue = jira.create_issue(fields=issue_dict)

However, I receive an error:

Traceback (most recent call last):
  File "create.py", line 10, in <module>
    new_issue = jira.create_issue(fields=issue_dict)
  File "/usr/lib/python2.7/site-packages/jira/client.py", line 1089, in create_issue
    r = self._session.post(url, data=json.dumps(data))
  File "/usr/lib/python2.7/site-packages/jira/resilientsession.py", line 154, in post
    return self.__verb('POST', url, **kwargs)
  File "/usr/lib/python2.7/site-packages/jira/resilientsession.py", line 147, in __verb
    raise_on_error(response, verb=verb, **kwargs)
  File "/usr/lib/python2.7/site-packages/jira/resilientsession.py", line 57, in raise_on_error
    r.status_code, error, r.url, request=request, response=r, **kwargs)
jira.exceptions.JIRAError: JiraError HTTP 500 url: https://localhost.....

is it error caused due to improper installation of jira module or issue at jira server.

Dov Benyomin Sohacheski
  • 7,133
  • 7
  • 38
  • 64
  • Check if you can make a HEAD request. You can use requests.HEAD() – sjaymj62 Jun 29 '18 at 07:56
  • Can you give some more clarification on this... where to give this HEAD() request – Vamsi Gundimeda Jun 29 '18 at 08:01
  • I have not used the python jira module. But you can try to check if the problem is with your jira module itself or the server. So, I would simply try to make a HEAD request to the url and check if it returns a response 200. SOmething like this, res = requests.head(url, auth=("username","password")) – sjaymj62 Jun 29 '18 at 08:05
  • it is hitting the server and returns 500 error means... – Vamsi Gundimeda Jun 29 '18 at 09:16
  • 500 means internal error on server. I don't use Jira but on web servers it mostly means problems with connection to database. So your problem is not in this code but rather in Jira configuration. – furas Jul 04 '18 at 15:00

0 Answers0