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.