You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The second way is to turn the github_organization argument into an option and doing this:
# Turn `github_organization` into an optionifgithub_organization:
repos=Github(github_access_token).get_organization(github_organization).get_repos()
else:
repos=Github(github_access_token).get_user().get_repos(affiliation="owner")
Not providing a user name for Github(github_access_token).get_user() retrieves the user authenticated by the token. Calling get_repos() on that user retrieves private repositories but also includes all repositories of organizations the user is a member of. This can be controlled by the affiliation parameter of get_repos to only retrieve repositories owned by the user.
I think the second option is preferable.
The text was updated successfully, but these errors were encountered:
Trying to test #1, I realized that the updater currently only works for actual GitHub organizations and not for users.
There are two ways of supporting GitHub users.
The CLI argument
github_organization
could be renamed togithub_organization_or_user
and the repositories could be retrieved like this:However, this only retrieves a user's public repositories and the REST API that backs this specific PyGithub functionality does not provide a way to list private repositories.
The second way is to turn the
github_organization
argument into an option and doing this:Not providing a user name for
Github(github_access_token).get_user()
retrieves the user authenticated by the token. Callingget_repos()
on that user retrieves private repositories but also includes all repositories of organizations the user is a member of. This can be controlled by theaffiliation
parameter ofget_repos
to only retrieve repositories owned by the user.I think the second option is preferable.
The text was updated successfully, but these errors were encountered: