Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github.GithubException.UnknownObjectException: 404 for iterating over issues #2625

Closed
PatrickAlphaC opened this issue Jul 13, 2023 · 2 comments

Comments

@PatrickAlphaC
Copy link

The following python code:

def mark_duplicates(git_repo_url: str, git_pat_token: str):
    github_logged_in: Github = Github(git_pat_token)
    owner, repo = get_owner_and_repo(git_repo_url)
    repo = github_logged_in.get_repo(owner, repo)
    repo_issues: Github.PaginatedList.PaginatedList = repo.get_issues(state="open")
  
    for issue in repo_issues:
        # ERROR HERE
        print(issue)

Results in the following error:

dup_hawk/dup_hawk.py:37: in mark_duplicates
    for issue in repo_issues:
.venv/lib/python3.10/site-packages/github/PaginatedList.py:69: in __iter__
    newElements = self._grow()
.venv/lib/python3.10/site-packages/github/PaginatedList.py:80: in _grow
    newElements = self._fetchNextPage()
.venv/lib/python3.10/site-packages/github/PaginatedList.py:213: in _fetchNextPage
    headers, data = self.__requester.requestJsonAndCheck(
.venv/lib/python3.10/site-packages/github/Requester.py:442: in requestJsonAndCheck
    return self.__check(
>           raise self.__createException(status, responseHeaders, data)
E           github.GithubException.UnknownObjectException: 404 {"message": "Not Found", "documentation_url": "https://docs.github.com/rest/reference/repos#get-a-repository"}
.venv/lib/python3.10/site-packages/github/Requester.py:487: UnknownObjectException

I think my PAT token has enough privledges... I'm just looking to see the issues. Oddly, if I do repo_issues.totalCount I get the same error.

@EnricoMi
Copy link
Collaborator

Which privileges did you grant your PAT?

@PatrickAlphaC
Copy link
Author

sorry on my delay here. Looks like it was a PAT issue. Sorry about this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants