Skip to content

Instantly share code, notes, and snippets.

@peterbe
Created February 17, 2016 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterbe/d41c7418c6e2b9e65347 to your computer and use it in GitHub Desktop.
Save peterbe/d41c7418c6e2b9e65347 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
import xml.etree.ElementTree as ET
import requests
STAGE = 'https://webqa-ci.mozilla.com/view/Socorro/job/socorro.stage.saucelabs/rssAll'
PROD = 'https://webqa-ci.mozilla.com/view/Socorro/job/socorro.prod.saucelabs/rssAll'
def run():
for url, name in ((STAGE, 'STAGE'), (PROD, 'PROD')):
print name, u'⏱'
xml = requests.get(url).text
root = ET.fromstring(xml)
ns = {
'atom': 'http://www.w3.org/2005/Atom',
}
for entry in root.findall('atom:entry', ns):
for title in entry.findall('atom:title', ns):
if 'broken' in title.text:
print u'💔 \tBROKEN!'
else:
print u'👍 \tAhhhh, everything seems to be fine.'
print "({})".format(title.text)
for link in entry.findall('atom:link', ns):
print link.attrib['href']
break
print
if __name__ == '__main__':
import sys
sys.exit(run())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment