Skip to content

Instantly share code, notes, and snippets.

@misterjoa
Last active October 5, 2018 12:06
Show Gist options
  • Select an option

  • Save misterjoa/e934ebd2a11debd55e02bb36ac9cb0a0 to your computer and use it in GitHub Desktop.

Select an option

Save misterjoa/e934ebd2a11debd55e02bb36ac9cb0a0 to your computer and use it in GitHub Desktop.
Get repo list from github python API
#!/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