Last active
July 15, 2016 22:04
-
-
Save emceeaich/9799c5b3ebd04df97c4c6022270fe087 to your computer and use it in GitHub Desktop.
Python Script to get Firefox Related Components
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 urllib2 | |
import csv | |
fd = urllib2.urlopen("https://bugzilla.mozilla.org/rest/product?names=Core&names=Firefox&names=Toolkit&names=Firefox%20for%20iOS&names=Firefox%20for%20Android&type=selectable&include_fields=id,name,components,is_active") | |
d = json.load(fd) | |
components = [] | |
for p in d['products']: | |
if not p['is_active']: | |
continue | |
for c in p['components']: | |
if not c['is_active']: | |
continue | |
component_data = { | |
'product_name': p['name'], | |
'component_name': c['name'], | |
} | |
components.append(component_data) | |
with open('firefox-components.csv', 'w') as csvfile: | |
fieldnames = ['product_name', 'component_name'] | |
writer = csv.DictWriter(csvfile, fieldnames = fieldnames); | |
writer.writeheader(); | |
for c in components: | |
writer.writerow(c) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment