Skip to content

Instantly share code, notes, and snippets.

@rhelmer
Created December 21, 2011 00:04
Show Gist options
  • Save rhelmer/1503886 to your computer and use it in GitHub Desktop.
Save rhelmer/1503886 to your computer and use it in GitHub Desktop.
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,
@twobraids
Copy link

in the case where 'addons' is not in data, line 21 will raise a KeyError and halt the execution of your script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment