Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import os
import json
import requests
repos = requests.get('https://api.github.com/orgs/OpenDataServices/repos?per_page=200').json()
for repo in repos:
protection = requests.get(
"https://api.github.com/repos/OpenDataServices/{}/branches/master/protection".format(repo["name"]),
headers={"Authorization": "token {}".format(os.environ["GH_TOKEN"])},
).json()
repo["master_protection"] = protection
with open('repos_with_master_protection_info.json', 'w') as fp:
json.dump(repos, fp, indent=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment