Search code examples
pythonpython-2.7jirajira-rest-apipython-jira

Fetch bug status on JIRA using Python-Jira


I am trying to write a script to fetch the status of a bug on JIRA,

import jira.client
from jira.client import JIRA

options = {'server': 'https://<url>:<port>/', 'verify': 'path/to/id_rsa.pub'}
jira = JIRA(options, basic_auth=('username', 'pswd'))

But getting following warning messages and unable to connect:

bash-4.2$ python try_jira.py
WARNING:root:unknown error (_ssl.c:2747) while doing GET https://spg-jira.xpliant.com:8443/rest/api/2/serverInfo [{u'headers': {'Accept-Encoding': 'gzip, deflate', u'Accept': u'application/json,*.*;q=0.9', 'User-Agent': 'python-requests/2.17.3', 'Connection': 'keep-alive', u'X-Atlassian-Token': u'no-check', u'Cache-Control': u'no-cache', u'Content-Type': u'application/json'}, 'params': None}]
WARNING:root:Got ConnectionError [unknown error (_ssl.c:2747)] errno:None on GET https://spg-jira.xpliant.com:8443/rest/api/2/serverInfo
{'request': <PreparedRequest [GET]>, 'response': None}\{'request': <PreparedRequest [GET]>, 'response': None}
WARNING:root:Got recoverable error from GET https://spg-jira.xpliant.com:8443/rest/api/2/serverInfo, will retry [1/3] in 7.55620272034s. Err: unknown error (_ssl.c:2747)
WARNING:root:unknown error (_ssl.c:2747) while doing GET https://spg-jira.xpliant.com:8443/rest/api/2/serverInfo [{u'headers': {'Accept-Encoding': 'gzip, deflate', u'Accept': u'application/json,*.*;q=0.9', 'User-Agent': 'python-requests/2.17.3', 'Connection': 'keep-alive', u'X-Atlassian-Token': u'no-check', u'Cache-Control': u'no-cache', u'Content-Type': u'application/json'}, 'params': None}]
WARNING:root:Got ConnectionError [unknown error (_ssl.c:2747)] errno:None on GET https://spg-jira.xpliant.com:8443/rest/api/2/serverInfo
{'request': <PreparedRequest [GET]>, 'response': None}\{'request': <PreparedRequest [GET]>, 'response': None}
WARNING:root:Got recoverable error from GET https://spg-jira.xpliant.com:8443/rest/api/2/serverInfo, will retry [2/3] in 8.41708571146s. Err: unknown error (_ssl.c:2747)
WARNING:root:unknown error (_ssl.c:2747) while doing GET https://spg-jira.xpliant.com:8443/rest/api/2/serverInfo [{u'headers': {'Accept-Encoding': 'gzip, deflate', u'Accept': u'application/json,*.*;q=0.9', 'User-Agent': 'python-requests/2.17.3', 'Connection': 'keep-alive', u'X-Atlassian-Token': u'no-check', u'Cache-Control': u'no-cache', u'Content-Type': u'application/json'}, 'params': None}]
WARNING:root:Got ConnectionError [unknown error (_ssl.c:2747)] errno:None on GET https://spg-jira.xpliant.com:8443/rest/api/2/serverInfo
{'request': <PreparedRequest [GET]>, 'response': None}\{'request': <PreparedRequest [GET]>, 'response': None}
WARNING:root:Got recoverable error from GET https://spg-jira.xpliant.com:8443/rest/api/2/serverInfo, will retry [3/3] in 39.7347032392s. Err: unknown error (_ssl.c:2747)

If I keep 'verify' : False in options, I see following messages:

bash-4.2$ python try_jira.py
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)

Can someone help me in figuring out if I am missing anything here?


Solution

  • The docs say:

    Making unverified HTTPS requests is strongly discouraged, however, if you understand the risks and wish to disable these warnings, you can use disable_warnings():

    >>> import urllib3
    >>> urllib3.disable_warnings()
    

    So you could put that disable_warnings call in your code, if you understand the implications.