【发布时间】:2018-08-16 06:15:03
【问题描述】:
首先,我对gerrit的理解有限。
我正在尝试使用 python 访问 Gerrit Rest API,但无法访问。我想获取与帐户相关的所有信息(提交、评论)。
from requests.auth import HTTPDigestAuth
from pygerrit2 import GerritRestAPI, HTTPBasicAuth
auth = HTTPBasicAuth('user', 'password')
from pygerrit2 import GerritRestAPI
rest = GerritRestAPI(url='https://xxx.xx.xxx.xxx.com/', auth = auth)
changes = rest.get("changes/?q=is:open&q=is:close&q=all&o=DETAILED_ACCOUNTS&o=ALL_REVISIONS&o=ALL_COMMITS&o=ALL_FILES&o=MESSAGES", headers={'Content-Type': 'application/json'})
我得到的错误是:
ConnectionError: HTTPSConnectionPool(host='xxx.xx.xxx.xxx.com', port=443): Max retries exceeded with url: /login/a/changes/?q=is:open&q=is:close&q=all&o=DETAILED_ACCOUNTS&o=ALL_REVISIONS&o=ALL_COMMITS&o=ALL_FILES&o=MESSAGES (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x825bad0>: Failed to establish a new connection: [Errno 110] Connection timed out',))
如果我将查询复制粘贴到 url 中,我可以获取信息,但不能通过 python 获取。怎么做? 如果问题不清楚,请评论/编辑。 谢谢
【问题讨论】: