github3.py icon indicating copy to clipboard operation
github3.py copied to clipboard

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

Open adosib opened this issue 1 year ago • 1 comments

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

adosib avatar Mar 25 '23 22:03 adosib

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"
              }
            }
          },

offbyone avatar Apr 25 '23 16:04 offbyone