Last active
April 21, 2019 13:15
-
-
Save nickbauman/7f773716ce72e527e67e0c960121bd6c to your computer and use it in GitHub Desktop.
Lists all the repos, pub and priv, of a github user or organization. Prompts for password and/or 2FA token
This file contains hidden or 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
from github3 import login | |
# Python 3 | |
prompt = input | |
if __name__ == '__main__': | |
if len(sys.argv) > 1: | |
passwd = prompt('Enter password: ') | |
twofa = prompt('Enter 2FA code: ') | |
org = sys.argv[1] | |
gh = login('<your username>', passwd, two_factor_callback=lambda: twofa) | |
print("looking up repos in '{}'".format(org)) | |
for short_repository in gh.repositories_by(org): | |
if short_repository.fork: # skip non-original repos | |
continue | |
print(short_repository.url) | |
else: | |
print("supply argument for organization or username") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment