使用pygerrit从gerrit url获取robotcomments失败

2024-10-03 23:31:04 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图编写一个小应用程序,从gerrit url的内容中提取robot注释:

rest = GerritRestAPI(url=options.gerrit_url, auth=HTTPDigestAuth(raw_input("username: "), raw_input("Password: ")), verify=True)

try:
    changes = rest.get("gerrit/#/c/{change_id}/robotcomments")
    logging.info("%d changes", len(changes))
    for change in changes:
        logging.info(change['change_id'])
except RequestException as err:
    logging.error("Error: %s", str(err))

我按照restapi获取机器人评论数据, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-change-robot-comments

由于某种原因,我得到一个404错误页面不存在。 有人知道如何使用pygerrit从url重新生成提交信息吗?在

我在调用rest.get("gerrit/#/c/{change_id}/robotcomments")中尝试了很多添加url的方法,或者是{} 或者gerrit/#/c/{change_id}/robotcomments它们都不起作用,我还发现调用rest.get会将“a”添加到url中,因此我尝试使用下划线代码而不是pygerrit:

^{pr2}$

这也是失败的,请让我知道我做错了什么?在


Tags: inforestidurlinputgetrawlogging