首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法通过python-jira lib连接到JIRA-api。

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

Stack Overflow用户
提问于 2017-09-11 04:46:02
回答 1查看 2.7K关注 0票数 2

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

代码语言:javascript
复制
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))

我有个错误

代码语言:javascript
复制
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',))
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-09-11 04:59:52

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

代码语言:javascript
复制
jira = JIRA(basic_auth=(un, pwd), options={'server': server})

所以你的代码是这样的:

代码语言:javascript
复制
from jira import JIRA

username = 'my_user_name'
password = 'my_pass'
jira = JIRA(basic_auth=(username, password), options = {'server': 'https://pm.maddevs.co/'})
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46148341

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档