简体   繁体   English

使用Python-Jira在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, 我正在尝试编写脚本以获取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: 如果我在选项中保留'verify' : False ,我会看到以下消息:

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? 有人可以帮我弄清楚我是否在这里遗漏了什么吗?

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(): 强烈建议不要进行未经验证的HTTPS请求,但是,如果您了解风险并希望禁用这些警告,则可以使用disable_warnings():

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

So you could put that disable_warnings call in your code, if you understand the implications. 因此,如果您了解其中的含义,则可以在代码中放入disable_warnings调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM