如何访问 XML 版本的 CruiseContol.NET Web 仪表板报告(通过 HTTP)?
我需要确定上次构建的状态(成功/失败),我这样做是这样的:
report_url = 'http://.../ViewLatestBuildReport.aspx'
success_marker = '<td class="header-title" colspan="2">BUILD SUCCESSFUL</td>'
page = urllib.urlopen(report_url)
if all(success_marker not in line for line in page):
# build is not good, do something
...
但这很浪费(加载整个 HTML 页面),容易出错(我已经遇到了 bytes/unicode bug)并且脆弱。
I need to determine state of last build (success/failure) and I do it like this:
report_url = 'http://.../ViewLatestBuildReport.aspx'
success_marker = '<td class="header-title" colspan="2">BUILD SUCCESSFUL</td>'
page = urllib.urlopen(report_url)
if all(success_marker not in line for line in page):
# build is not good, do something
...
But this is wasteful (loads entire HTML page), error-prone (I already ran into a bytes/unicode bug) and fragile.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我大概明白了。 CCTray 通过轮询 XmlServerReport.aspx 来跟踪构建状态,这是(令人惊讶!)XML。
所以我当前的解决方案如下所示:
在我的环境中,它比最初的基于 HTML 的解决方案快大约 8 倍。
OK, I sort of figured it out. CCTray tracks build status by polling
XmlServerReport.aspx
, which is (surprise!) XML.So my current solution looks like this:
In my environment it is about 8 times faster than initial HTML-based solution.