#!/usr/bin/python3 import json import urllib.request user = 'pabs3' data = {} for type in ('repos', 'subscriptions', 'orgs'): data[type] = 'https://api.github.com/users/%s/%s' % (user, type) data[type] = urllib.request.urlopen(data[type]) data[type] = json.load(data[type]) try: data[type] = [repo[u'full_name'] for repo in data[type]] except KeyError: orgs = list(data[type]) data[type] = [] for org in orgs: repos = urllib.request.urlopen(org[u'repos_url']) repos = json.load(repos) data[type].extend([repo[u'full_name'] for repo in repos]) print('\n'.join(sorted(list(set(sum(data.values(), [])))))) fixme = ''' FIXME: Use the GraphQL API to determine this instead: query { viewer { repositories(affiliations: [OWNER, COLLABORATOR], first: 10) { nodes { nameWithOwner } } } } '''