1

I have generated a github access token. I've tried to access the repos from pygithub and also github api v3, stuff was fine.

Now using github3 I cannot access my private repos. I am using python(I know that you know).

repos = github3.login(token=get_github_token()).repositories_by('myusername')

Code structure feels like I am trying to access some one else's private repos. Its not the same way in pygithub. In pygithub you can get your own repos without passing the username.

hungryWolf
  • 391
  • 1
  • 3
  • 15

1 Answers1

1

You're very close to a solution, you just need a slightly different method:

gh = github3.login(token=get_github_token())
for repos in gh.repositories():
    ...

As you noticed repositories_by is for listing another user's public repositories. Also all_repositories is used to list all public repositories on GitHub. But repositories requires you to be authenticated and allows you to list which repositories you want, e.g.,

gh.repositories(type='all')
gh.repositories(type='owner')
gh.repositories(type='member')
gh.repositories(type='private')
gh.repositories(type='public')
Ian Stapleton Cordasco
  • 26,944
  • 4
  • 67
  • 72