Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This is a question I have answered myself.</p> <p>Summary of process </p> <ul> <li>use a HTTP proxy sniffer to determine the format of the URL - see below</li> <li>using py-ntlm, connect to TFS server, using a known format of URL to get the "full" report page,</li> <li>parse the report page to get the image url, down load that again through py-ntlm, and store.</li> </ul> <p>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.</p> <p>The url you will need to directly visit the report for your team is similar to <a href="http://tfs.example.com/reportserver?/TfsReports/ExampleCompany/ExampleProject/Sprint+Burndown+Chart&amp;rc:toolbar=false&amp;pReleaseWorkStreamPath=" rel="nofollow">http://tfs.example.com/reportserver?/TfsReports/ExampleCompany/ExampleProject/Sprint+Burndown+Chart&amp;rc:toolbar=false&amp;pReleaseWorkStreamPath=</a>\Release01\&amp;pSprintTeam=\Release02\Sprint01\Team01</p> <p>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</p> <p>The below <em>process</em> is sound but the code is brittle and I just recommend it as a starting point</p> <h2>Identify the URL of the report</h2> <p>Install py-ntlm (http://code.google.com/p/python-ntlm/)</p> <p>(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</p> <pre><code>import urllib2 from ntlm import HTTPNtlmAuthHandler # passman = urllib2.HTTPPasswordMgrWithDefaultRealm() passman.add_password(None, url, user, password) ## (a) auth_NTLM = HTTPNtlmAuthHandler.HTTPNtlmAuthHandler(passman) #(b) opener = urllib2.build_opener(auth_NTLM) urllib2.install_opener(opener) # (c) response = urllib2.urlopen(url_moi) html = response.read() </code></pre> <p>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 :-)</p> <p>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.</p> <p>I hope that helps. </p> <p>YMMV</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload