在 TFS 中,如何访问 ReportServer URL 以获取每日 scrum 燃尽图的 jpeg 格式?
我想访问 TFS 服务器,并定期下载动态生成的“Scrum Burndown 图表”,以便在单独的报告(即 pdf)中重新使用它 是的,有很多报告......
我如何在服务器中找到正确的 URL 进行下载,以及如何解决权限问题?
I wanted to access a TFS server, and download the dynamically produced "Scrum Burndown chart" on a regular basis, in order to re-use it in a seperate report (ie a pdf)
Yes, there is a lot of reporting going around ...
How do I find the correct URL in the server to download, and how do I get around the permissions problems?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是我自己回答过的一个问题。
过程摘要
没有直接的 URL,即我无法请求 reportserver/myteam/burndownchart/20110815 (很好且安静),但有一个参数样式请求
包装器“报告”我想要的图像。遗憾的是,没有简单的方法可以通过浏览 VS2010 扩展来找到它 - 我使用 Charles 调试器代理来查看 VS2010 发送的内容。
您需要直接访问您团队的报告的 URL 类似于
http://tfs.example.com/reportserver?/TfsReports/ExampleCompany/ExampleProject/Sprint+Burndown+Chart&rc:toolbar=false&pReleaseWorkStreamPath=\Release01\&pSprintTeam= \Release02\Sprint01\Team01
正在进行一些基于会话的混淆与实际的图像 URL,这意味着我必须调用然后解析报告页面,找到图像的 URL,然后下载它。最重要的是,我需要让 Python 与 Windows 身份验证一起工作,并且通常会进行大量的工作
下面的过程是合理的,但代码很脆弱,我只是推荐它作为起点
识别报告的 URL
安装 py-ntlm (http://code.google.com/p/python-ntlm/)
(a) 您需要每次创建用户密码和请求的 url 的哈希值(这通常在浏览器中是不可见的) )
(b) 然后将其作为 urllib2 处理程序传递给 urllib2
(c) 像往常一样通过 urllib2 处理 url,
这样我就可以得到标准报告网页,其中包含图像。我现在需要提取该图像 url,为此我使用正则表达式来获取
所有 IMG 标签并占据列表中的第二个。专业而且一点也不脆弱:-)
然后我们重建 nltm 哈希(我已经下载了 HTML 报告页面,现在我想要其中的 JPG 图像),
调用上面的 URL 并将输出写入本地磁盘。
我希望这有帮助。
青年MMV
This is a question I have answered myself.
Summary of process
There is no direct URL ie I cannot ask for reportserver/myteam/burndownchart/20110815 (nice and restful) but there is a param style request for the
wrapper "report" to the image I want. Sadly there is no easy way to find it just browsing in VS2010 extension - I used Charles debugger proxy to see what VS2010 is sending.
The url you will need to directly visit the report for your team is similar to
http://tfs.example.com/reportserver?/TfsReports/ExampleCompany/ExampleProject/Sprint+Burndown+Chart&rc:toolbar=false&pReleaseWorkStreamPath=\Release01\&pSprintTeam=\Release02\Sprint01\Team01
There is some Session based obfuscation going on with the actual image URL, meaning I must call then parse the report page, to find the URL of the image, and then download it. On top of that I needed to get Python to work with Windows Authentication, and generally fiddled around a great deal
The below process is sound but the code is brittle and I just recommend it as a starting point
Identify the URL of the report
Install py-ntlm (http://code.google.com/p/python-ntlm/)
(a) You need to create a hash of user pass and requested url each time (this is invisible by browser usually)
(b) THen pass that as a urllib2 handler to urllib2
(c) process the url as usual through urllib2
SO that gets me the standard report web page, with image in it. I now need to extract that image url, for which I used a regex to get
all IMG tags and took the second one in the list. Professional and not at all brittle :-)
We then rebuild the nltm hash (I have downloaded the HTML report page, now I want the JPG image in it),
call the URL above and write the output to local disk.
I hope that helps.
YMMV