On a Redhat box (Red Hat Enterprise Linux Workstation release 6.8 (Santiago)) I am able to make a curl
request to the JIRA instance like follows:
curl -k -D- -u "user":"password" -X GET -H "Content-Type: application/json" https://some_url/jira/rest/api/2/search?jql=assignee=fritz
This request returns a valid json with the actual data in it. So far so good.
To access and evaluate the information from the json I am trying to use jira-python in order to have a parser for the jira json's. The code is as follows:
jira = JIRA('https://some_url/jira', basic_auth=('user','password'))
which results in an error like follows:
WARNING:root:[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749) while doing GET https://some_url/jira/rest/api/2/serverInfo [{'params': None, 'headers': {'User-Agent': 'python-requests/2.12.4', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json,*.*;q=0.9', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache', 'Content-Type': 'application/json', 'X-Atlassian-Token': 'no-check'}}]
Why do I have a certificate error when trying to access the JIRA with python, but I do not when using curl? And how to fix this?
If you want to skip the certificate validation(not secure), set verify to False.
jira = JIRA('https://some_url/jira', verify=False, basic_auth=('user','password'))
As @frlan pointed out, it's better to validate the certificate. Just go through the JIRA arguments, and specify your client certificate for validation.
Explanation: https://github.com/pycontribs/jira/blob/5cade37e56612caee36db6310b6e0ef935726944/jira/client.py
* verify -- Verify SSL certs. Defaults to ``True``.