首先,我对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却不能。该怎么办? 如果问题不清楚,请评论/编辑。 谢谢