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

github3.exceptions.IncompleteResponse: None The library was expecting more data in the response (KeyError('total')) #1135

Open
adosib opened this issue Mar 25, 2023 · 1 comment

Comments

@adosib
Copy link

adosib commented Mar 25, 2023

Getting an github3.exceptions.IncompleteResponse exception when there haven't been any changes in the gist revision.

Should be a quick fix but apparently everything is locked down so I can't issue a PR. Should just be a matter of changing this line
from
self.total = self.change_status["total"]
to
self.total = self.change_status.get("total")

Version Information

  • python==3.10.8
  • pip==22.2.2
  • github3.py==2.3.0
  • requests==2.28.2
  • uritemplate====4.1.1

Minimum Reproducible Example

Can't figure out a way to easily make this reproducible but I've got some gist that in its revision history is not always getting changed and so I get the exception github3.exceptions.IncompleteResponse

>>> import github3
>>> gist_id = "..."
>>> token="..."
>>> gh = github3.login(token=token)
>>> svg = gh.gist(gist_id)
github3.exceptions.IncompleteResponse: None The library was expecting more data in the response (KeyError('total')). Either GitHub modified it's response body, or your token is not properly scoped to retrieve this information.

Exception information

github3.exceptions.IncompleteResponse

@offbyone
Copy link
Contributor

I'm curious what the response was to the call, because total is required by the schema; unlike some keys in there, it's not optional. I think this is actually the right error, and the API sent an invalid response:

          "change_status": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer"
              },
              "additions": {
                "type": "integer"
              },
              "deletions": {
                "type": "integer"
              }
            }
          },

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