Created
February 17, 2016 18:52
-
-
Save peterbe/d41c7418c6e2b9e65347 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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 | |
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