Created
September 12, 2017 16:52
-
-
Save luser/986e93cb12e49d6b38fd026b463ac979 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
#!/usr/bin/env python | |
from __future__ import print_function | |
import itertools | |
import requests | |
INDEX = 'https://index.taskcluster.net/v1/' | |
QUEUE = 'https://queue.taskcluster.net/v1/' | |
def index_namespaces(namespace, limit=1000): | |
r = requests.post(INDEX + 'namespaces/' + namespace, | |
json={'limit': limit}) | |
for n in r.json()['namespaces']: | |
yield n['namespace'] | |
def index_tasks(namespace, limit=1000): | |
r = requests.post(INDEX + 'tasks/' + namespace, | |
json={'limit': limit}) | |
for t in r.json()['tasks']: | |
yield t['taskId'] | |
def tasks_by_changeset(revisions_limit): | |
for n in index_namespaces('gecko.v2.mozilla-central.nightly.revision', revisions_limit): | |
for t in index_tasks(n + '.firefox'): | |
yield t | |
def list_artifacts(task_id): | |
r = requests.get(QUEUE + 'task/%s/artifacts' % task_id) | |
if r.status_code != 200: | |
return [] | |
return [a['name'] for a in r.json()['artifacts']] | |
def get_symbols_urls(): | |
for t in tasks_by_changeset(5): | |
artifacts = list_artifacts(t) | |
full = [a for a in artifacts if a.endswith('.crashreporter-symbols-full.zip')] | |
if full: | |
yield QUEUE + 'task/%s/artifacts/%s' % (t, full[0]) | |
else: | |
small = [a for a in artifacts if a.endswith('.crashreporter-symbols.zip')] | |
if small: | |
yield QUEUE + 'task/%s/artifacts/%s' % (t, small[0]) | |
if __name__ == '__main__': | |
n = 10 | |
for url in itertools.islice(get_symbols_urls(), n): | |
print(url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment