Hi,
I'm having trouble calling get_repo with the name of a repo I have access to in an organization.
Here's what I simply do:
repo = me.get_user().get_repo(name_of_organization_repo_i_have_access_to)
This is what I get:
github.GithubException.UnknownObjectException: 404 {'documentation_url': 'https://developer.github.com/v3', 'message': 'Not Found'}
It works fine with a repo associated to my own account. But as soon as I need one from an organization it fails.
What is strange to me is that:
repos = me.get_user().get_repos()
Shows the repo in the list as expected.
Am I missing something obvious?
+1 I am having the same issue. The problem is that this line sets the user to be the authenticated user explicitly. I can't seem to find another method in the API that allows us access to the repo by full name.
https://github.com/PyGithub/PyGithub/blob/master/github/AuthenticatedUser.py#L851
@mlainez Actually, looks like we should be using the get_repo()
method on the main class. So it would be:
>> g = Github("user", "password") >> repo = g.get_repo("Org/RepoName", lazy=False) >> repo Repository(full_name="Org/RepoName")
I will probably add this to some example usage page.
I'm trying @RichardJTorres's solution, but still get a 404. Can access non private repos, but not organization repos.
Ah, the problem was that I hadn't given the token the right permissions. Clear.
Ah, the problem was that I hadn't given the token the right permissions. Clear.
@PedroGFonseca do you remember what permissions the token needed for this? I'm experiencing the same issue.
@thecturner It works for me with the repo
scope.
Most helpful comment
@mlainez Actually, looks like we should be using the
get_repo()
method on the main class. So it would be: