Created
December 21, 2011 00:04
-
-
Save rhelmer/1503886 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
import json | |
import sys | |
import urllib2 | |
top_level_url = 'https://crash-stats.mozilla.com' | |
opener = urllib2.build_opener() | |
urllib2.install_opener(opener) | |
bad_addons = [line.strip() for line in open('bad_addons.txt')] | |
for ooid in sys.stdin: | |
full_url = '/'.join([top_level_url, 'dumps', ooid]).rstrip() | |
data = json.load(opener.open(full_url + '.jsonz')) | |
if 'addons' not in data: | |
print 'Missing addon field found for %s' % ooid, | |
elif data['addons'] == []: | |
print 'No addons found for %s' % ooid, | |
for addon in data['addons']: | |
addon_id,version = addon | |
if addon_id in bad_addons: | |
print 'Bad addon found for %s' % ooid, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in the case where 'addons' is not in data, line 21 will raise a KeyError and halt the execution of your script