Created
March 18, 2020 11:44
-
-
Save Bjwebb/fe4ff5c0e81df35feb001c5af8fb1b3a 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
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