Skip to content

Instantly share code, notes, and snippets.

@Bjwebb
Created March 18, 2020 11:44
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Bjwebb/fe4ff5c0e81df35feb001c5af8fb1b3a to your computer and use it in GitHub Desktop.
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