Last active
September 6, 2017 09:38
-
-
Save yosshy/4cf7c724bc31826f50a5fda154c0ff75 to your computer and use it in GitHub Desktop.
OpenStack Repositories Counter
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/python | |
import requests | |
import yaml | |
URL = ("https://git.openstack.org/cgit/openstack/" | |
"governance/plain/reference/projects.yaml") | |
def walk(data): | |
refs = 0 | |
for key, value in data.items(): | |
if isinstance(value, dict): | |
refs += walk(value) | |
if key == "repos": | |
refs += 1 | |
return refs | |
with requests.get(URL) as r: | |
p = yaml.load(r.text) | |
print(walk(p)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment