Description
Typically Github Enterprise is lagging keywords in the responses that are seen from github.com. Currently seeing the following error on trying to use this library with a local GitHub Enterprise instance.
IncompleteResponse [The library was expecting more data in the response (KeyError(u'license',)). Either GitHub modified it's response body, or your token is not properly scoped to retrieve this information.]
Thrown by a call to (github3.enterprise_login()).repository()
Patching the library to deal with this issue only results in seeing another issue:
IncompleteResponse: None The library was expecting more data in the response (KeyError(u'plan',)). Either GitHub modified it's response body, or your token is not properly scoped to retrieve this information.
Thrown by a call to (github3.enterprise_login()).me()
In both cases my token had full access, just that the public Github is returning more than the private versions.
One solution would be to update
Lines 160 to 163 in bf44c16
ret = collections.defaultdict(lambda: None)
try:
ret.update(response.json())
except ValueError:
raise exceptions.UnexpectedResponse(response)
But that would also require updating locations such as
Line 757 in bf44c16
if user['plan'] is not None:
self.plan = Plan(user['plan'], self)
else:
self.plan = None
That would mean looking through each definition of _update_attributes()
and modifying to test for None where the result of dictionary lookup was used to create an object.
This would certainly allow the library to work across a wide range of Github Enterprise releases, as well as simply returning None for certain data items when users scope tokens to have less permissions.
If this seems reasonable I can put together a PR to do the needful.