-
-
Save mikeal/178611 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
try: | |
import json | |
except: | |
import simplejson as json | |
import urllib | |
import types | |
tbox_url = 'http://tinderbox.mozilla.org/showbuilds.cgi?tree=Mobile&json=1&noignore=1' | |
logroot = "http://tinderbox.mozilla.org/showlog.cgi?log=Mobile/" | |
def search(): | |
jsonurl = urllib.urlopen(tbox_url) | |
#Hack to remove the tinderbox_data = from the front | |
data = jsonurl.read().split("=", 1) | |
jsonurl.close() | |
#Hack to replace the " in the json with ', and replace the original ' with " | |
data = data[1].strip("\n; ").replace("\"", "\\\"").replace("'", "\"").replace("\\\"", "'") | |
result = json.loads(data) | |
if 'Error' in result: | |
return "Error found in result" | |
return result | |
data = search() | |
build_table = data['build_table'] | |
build = build_table[0] | |
print build | |
for build in build_table: | |
for b in build: | |
if type(b) == types.IntType: | |
pass | |
else: | |
for k in b: | |
if (k == "buildname"): | |
print b[k] + " : " + logroot + b['logfile'] + "&fulltext=1" | |
#if b['logfile'] doesn't exist, download, parse, and upload | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment