Skip to content

Instantly share code, notes, and snippets.

@drags
Last active December 22, 2015 12:19
Show Gist options
  • Save drags/6471522 to your computer and use it in GitHub Desktop.
Save drags/6471522 to your computer and use it in GitHub Desktop.
# Steps to reproduce:
#
# GH_USER='my_github_username'
# GH_PASS='my_github_password'
#
# Create oauth token with repo:status scope:
# curl -i -d '{"scopes": ["repo:status"], "note":"Testing repo:status scope"}' "https://${GH_USER}:${GH_PASS}@api.github.com/authorizations"
# TOKEN_REPO=<insert token from output>
#
# Create oauth token with repo scope:
# curl -i -d '{"scopes": ["repo"], "note":"Testing repo scope"}' "https://${GH_USER}:${GH_PASS}@api.github.com/authorizations"
# TOKEN_REPO_STATUS=<insert token from output>
import github
org_name = 'myorganization'
g1_repo = github.Github(login_or_token=<TOKEN_REPO>)
g2_repo_status = github.Github(login_or_token=<TOKEN_REPO_STATUS>)
repo_scope_repos = [ x for x in g1_repo.get_organization(org_name).get_repos() ]
repo_status_scope_repos = [ x for x in g2_repo_status.get_organization(org_name).get_repos() ]
print g1_repo.oauth_scopes
print len(repo_scope_repos)
print g2_repo_status.oauth_scopes
print len(repo_status_scope_repos)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment