Skip to content

Instantly share code, notes, and snippets.

@mikeal
Forked from jmaher/gist:178605
Created August 31, 2009 17:59
Show Gist options
  • Save mikeal/178611 to your computer and use it in GitHub Desktop.
Save mikeal/178611 to your computer and use it in GitHub Desktop.
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