Last active
October 5, 2018 12:06
-
-
Save misterjoa/e934ebd2a11debd55e02bb36ac9cb0a0 to your computer and use it in GitHub Desktop.
Get repo list from github python API
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
| #!/usr/bin/env python | |
| """ | |
| Get a github API token using your account | |
| Then input the name of your org, don't forget '/' at the end. | |
| """ | |
| GH_TOKEN = "XXX" | |
| GH_ORG = "your_org/" | |
| import github | |
| def main(): | |
| gh = github.Github(GH_TOKEN) | |
| get_repo_list(gh) | |
| def get_repo_list(gh): | |
| repos = list(gh.get_user().get_repos()) | |
| for repo in repos: | |
| if GH_ORG in repo.full_name: | |
| print(repo.name) | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment