繁体   English   中英

无法通过 python-jira lib 连接到 JIRA-api

[英]Can't connect to JIRA-api via python-jira lib

我无法对 python-jira 进行身份验证 我尝试使用https://pypi.python.org/pypi/jira/根据我使用的文档

from jira import JIRA

jira = JIRA('https://pm.maddevs.co/') # I am not sure if it is correct to use our site server or jiras

username = 'my_user_name'
password = 'my_pass'
authed_jira = JIRA(basic_auth=(username, password))

我有这样的错误

WARNING:root:HTTPConnectionPool(host='localhost', port=2990): Max retries exceeded with url: /jira/rest/api/2/serverInfo (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f8a7e228198>: Failed to establish a new connection: [Errno 111] Connection refused',)) while doing GET http://localhost:2990/jira/rest/api/2/serverInfo [{'headers': {'X-Atlassian-Token': 'no-check', 'Content-Type': 'application/json', 'Accept-Encoding': 'gzip, deflate', 'Cache-Control': 'no-cache', 'Connection': 'keep-alive', 'Accept': 'application/json,*.*;q=0.9', 'User-Agent': 'python-requests/2.18.4'}, 'params': None}]
WARNING:root:Got ConnectionError [HTTPConnectionPool(host='localhost', port=2990): Max retries exceeded with url: /jira/rest/api/2/serverInfo (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f8a7e228198>: Failed to establish a new connection: [Errno 111] Connection refused',))] errno:None on GET http://localhost:2990/jira/rest/api/2/serverInfo
{'response': None, 'request': <PreparedRequest [GET]>}\{'response': None, 'request': <PreparedRequest [GET]>}
WARNING:root:Got recoverable error from GET http://localhost:2990/jira/rest/api/2/serverInfo, will retry [1/3] in 17.18299613314676s. Err: HTTPConnectionPool(host='localhost', port=2990): Max retries exceeded with url: /jira/rest/api/2/serverInfo (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f8a7e228198>: Failed to establish a new connection: [Errno 111] Connection refused',))

您应该使用以下格式连接到服务器:

jira = JIRA(basic_auth=(un, pwd), options={'server': server})

所以你的代码会是这样的:

from jira import JIRA

username = 'my_user_name'
password = 'my_pass'
jira = JIRA(basic_auth=(username, password), options = {'server': 'https://pm.maddevs.co/'})

暂无
暂无

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

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