如何使用jira-python创建问题

时间:2017-04-04 13:16:15

标签: python jira-rest-api

我提交了一个简单的脚本来测试通过python将问题发送到jira,

from jira import JIRA

jira_options={'server': 'https://jira.baidu.com', 'verify': False}

jira=JIRA(options=jira_options,basic_auth=('testuser','passw0rd'))

new_issue = jira.create_issue(project={'key': 'test'}, summary='New issue from jira-python',   description='Look into this one', issuetype={'name': 'Bug'})

但得到了错误:

/usr/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py:821: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
Traceback (most recent call last):
  File "test.py", line 5, in <module>
    jira=JIRA(options=jira_options,basic_auth=('testuser','passw0rd'))
  File "/usr/lib/python2.7/site-packages/jira/client.py", line 317, in __init__
    si = self.server_info()
  File "/usr/lib/python2.7/site-packages/jira/client.py", line 1771, in server_info
    j = self._get_json('serverInfo')
  File "/usr/lib/python2.7/site-packages/jira/client.py", line 2172, in _get_json
    r = self._session.get(url, params=params)
  File "/usr/lib/python2.7/site-packages/jira/resilientsession.py", line 150, in get
    return self.__verb('GET', url, **kwargs)
  File "/usr/lib/python2.7/site-packages/jira/resilientsession.py", line 146, in __verb
    raise_on_error(response, verb=verb, **kwargs)
  File "/usr/lib/python2.7/site-packages/jira/resilientsession.py", line 56, in raise_on_error
    r.status_code, error, r.url, request=request, response=r, **kwargs)
jira.exceptions.JIRAError: <exception str() failed>

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

我知道我迟到但你使用的是哪个python版本?对于python 3,导入对我来说就像这样。 试试这个:

id