【发布时间】:2019-04-29 01:30:39
【问题描述】:
我正在尝试通过 python (3.6) 连接 jira 的 API,但我不断收到错误消息:
警告:root:HTTPSConnectionPool(host='jira', port=443):最大重试次数超出了 url:/secure/rest/api/2/serverInfo/rest/api/2/serverInfo(由 SSLError(SSLError (“糟糕的握手:错误([('SSL例程','tls_process_server_certificate','证书验证失败')],)”,),))同时做GET https://jira/secure/rest/api/2/ serverInfo/rest/api/2/serverInfo [{'params': None, 'headers': {'User-Agent': 'python-requests/2.20.1', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json,.;q=0.9', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache', 'Content-Type' : 'application/json', 'X-Atlassian-Token': '无检查'}}] WARNING:root:Got ConnectionError [HTTPSConnectionPool(host='jira', port=443): Max retries exceeded with url: /secure/rest/api/2/serverInfo/rest/api/2/serverInfo (由 SSLError(SSLError (“糟糕的握手:错误([('SSL例程','tls_process_server_certificate','证书验证失败')],)”,),))]错误:在GET https://jira/secure/rest/api上没有/2/serverInfo/rest/api/2/serverInfo {'response':无,'request':
}{'response':无,'request': } 警告:root:从 GET https://jira/secure/rest/api/2/serverInfo/rest/api/2/serverInfo 获得可恢复错误,将在 7.466325591185807s 中重试 [1/3]。错误:HTTPSConnectionPool(主机='jira',端口=443):最大重试次数超出了 url:/secure/rest/api/2/serverInfo/rest/api/2/serverInfo(由 SSLError(SSLError(“糟糕的握手: Error([('SSL 例程', 'tls_process_server_certificate', '证书验证失败')],)",),))
这是我的代码:
un='myusername'
pwd='mypassword'
server='https://jira/xxxx'
jira = jira = JIRA(basic_auth=(un, pwd), options={'server': server})
issue = jira.issue('some issue name')
print(issue.fields.project.key)
print(issue.fields.issuetype.name)
在同一台服务器上使用 curl 时一切正常。
【问题讨论】:
-
Bad SSL handshake 告诉你 SSL 证书验证失败..
-
感谢您的回答,我注意到了这一点,但我正在使用 CURL 进行验证,没关系,只是通过 Python 使用 JIRA MODULE 会给出该错误......有什么想法吗?
-
您可以为验证选项提供必要的证书,如下面我的回答中所述。
-
任何成功或者您对该主题还有其他问题吗?
-
还是同样的错误信息,我将 jira 证书保存到文件并添加了您的行,这真的很奇怪,因为当我使用“请求”时,我能够连接。