Created
November 15, 2017 17:22
-
-
Save danielsamuels/1231c62b5e05a5f758fc06ce3c06b3ba to your computer and use it in GitHub Desktop.
SSH authentication using a Github organisation as a source
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/env python3 | |
import json | |
from urllib.request import urlopen | |
def main(): | |
with urlopen('https://api.github.com/orgs/onespacemedia/public_members') as f: | |
users = json.loads(f.read().decode('utf8')) | |
for user in users: | |
# Get the public keys for this user. | |
with urlopen('https://api.github.com/users/{}/keys'.format(user['login'])) as f: | |
keys = json.loads(f.read().decode('utf8')) | |
for key in keys: | |
print(key['key']) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment