我正在尝试编写一个小应用程序,它从gerrit url的内容中提取机器人注释:
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))
我按照rest-api获取机器人评论数据, https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-change-robot-comments
由于某种原因,我收到404错误,该页面不存在。 有谁知道如何使用pygerrit从网址重新提交提交信息?
我在调用rest.get("gerrit/#/c/{change_id}/robotcomments")
中尝试了多次添加到网址,change/{change_id}/robotcomments
或者gerrit/#/c/{change_id}/robotcomments
他们都没有工作,我也看到,拨打rest.get
会增加' a'到了url,所以我尝试使用underling代码而不是pygerrit:
url = "https/{gerrit_url}/gerrit/#/c/{change_id}/robotcomments"
myResponse = requests.get(url, auth=HTTPDigestAuth(raw_input("username: "), raw_input("Password: ")), verify=True)
print(myResponse.text)
这也失败了,请让我知道我做错了什么?
答案 0 :(得分:1)
查看Gerrit documentation,您似乎应该使用:
final_list = [1,2,3,4,5,6,7,8,9]
而不是:
rest.get("/changes/{change_id}/robotcomments")