2017-04-04 124 views
0

我申請了一個簡單的腳本來測試發送問題通過Python JIRA,如何使用JIRA,Python創建問題

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> 

如何解決這個?

+0

我試過很多次,都開始從該行彈出了錯誤:\ n JIRA(選項= jira_options,basic_auth =( 'testuser的', 'PASSW0RD')) – John

+0

我試圖導入JIRA兩個jira&jira.client庫,都發生了同樣的錯誤... – John

+0

我試圖回答這個問題,但爲什麼每次我提交我的答案,它不顯示? – John

回答

0

我知道我遲到了,但您使用的是哪種Python版本?對於python 3來說,導入對我來說就像這樣。 試試這個:

import jira.client 
    from jira.client import JIRA 
+0

海報使用Python 2.7,你可以在問題 –

+0

的報告錯誤的第一行看到它,感謝Umair,似乎我忘記了在這裏注意:它事實證明,這是驗證碼....在我完成驗證碼驗證後,它工作正常。我不太記得python版本。 – John