无法通过REST api https url连接到JIRA Python

时间:2013-02-15 18:40:59

标签: python ssl https connection jira

我尝试通过https连接到jira dev沙箱,但它出现了SSL23_GET_SERVER_HELLO:未知协议错误

这是错误日志/堆栈跟踪。我尝试了端口8080和443,但没有欢乐。

>>> from jira.client import JIRA


>>> options = {'server':'localhost:8080'}

>>> auth = ('username', 'password')
>>> jira = JIRA(options, auth)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ve/lib/python2.6/site-packages/jira/client.py", line 88, in __init__
    self._create_http_basic_session(*basic_auth)
  File "/home/ve/lib/python2.6/site-packages/jira/client.py", line 1369, in _create_http_basic_session
    r = self._session.post(url, data=json.dumps(payload))
  File "/home/ve/lib/python2.6/site-packages/requests/sessions.py", line 284, in post
    return self.request('post', url, data=data, **kwargs)
  File "/home/ve/lib/python2.6/site-packages/requests/sessions.py", line 241, in request
    r.send(prefetch=prefetch)
  File "/home/ve/lib/python2.6/site-packages/requests/models.py", line 638, in send
    raise SSLError(e)
requests.exceptions.SSLError: [Errno 1] _ssl.c:480: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

>>> options = {'server':'localhost:443'}

>>> auth = ('username', 'password')
>>> jira = JIRA(options, auth)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ve/lib/python2.6/site-packages/jira/client.py", line 88, in __init__
    self._create_http_basic_session(*basic_auth)
  File "/home/ve/lib/python2.6/site-packages/jira/client.py", line 1369, in _create_http_basic_session
    r = self._session.post(url, data=json.dumps(payload))
  File "/home/ve/lib/python2.6/site-packages/requests/sessions.py", line 284, in post
    return self.request('post', url, data=data, **kwargs)
  File "/home/ve/lib/python2.6/site-packages/requests/sessions.py", line 241, in request
    r.send(prefetch=prefetch)
  File "/home/ve/lib/python2.6/site-packages/requests/models.py", line 631, in send
    raise ConnectionError(sockerr)
requests.exceptions.ConnectionError: [Errno 110] Connection timed out
>>> 

2 个答案:

答案 0 :(得分:2)

试试这个:

from jira.client import JIRA
options = {'server':'localhost:8080'}
jira = JIRA(options)
jira = JIRA(basic_auth=('username', 'password')) 

如果没有帮助,有机会OpenSSL conflicts

  

当curl与OpenSSL 0.9.8链接并尝试访问运行OpenSSL 1.0.0的服务器时,SSL握手失败,并且:   curl:(35)错误:14077458:SSL例程:SSL23_GET_SERVER_HELLO:reason(1112)

答案 1 :(得分:0)

现在知道了。端口8080已设置,并且不是http连接的默认值,无论是https我使用验证操作基本上在jira-python方法体中设置validate = False