Any repos derived from getting a list of repos via the /user/repos url, and then turning the resulting json list into repo objects will be incomplete relative to fetching this information via the url given by repo.url (/repos/:user/:name).
I came across this when I used 'list_repos', and noticed that none of the repo objects had 'parent' or 'source' attributes.
Maybe repo objects can be made to fetch more json data via the self._api url, and update themselves?
Maybe then missing data attributes could be properties that execute this updater method?
My own quick-fix is to replace the last 'return' line of list_repos in github.py with:
return [Repository(self._json(self._get(repo['url']), 200), self) for repo in json]
The API does this in a large number of places. If you were to do:
from github3 import repository
r = repository('kennethreitz', 'requests')
u = next(r.iter_subscribers())
The last two don't exist. I don't think making a second request each time is the best idea, but I'm entirely ok with adding a new method to these objects to retrieve all of the information. I just can't think of a clever name at the moment. Can you think of one? Also, would this be palatable?
@pengwynn is there any chance the API would be modified to include the whole thing? Is there a reason everything isn't included in the first place? For an endpoint like this, I'm a bit surprised that source and parent aren't included.
Unfortunately we can't. Getting that info from Git is expensive so we only do it when you request a single repository.
Yeah, and I'd rather not forcibly tax the API by requesting everything each time, @Chris2048, so I'm going to lean towards adding methods to make this easier on you. Still not sure what a good name would be.
Also, thanks @pengwynn
Yeah, I guess I'm just going to go ahead and add a method refresh. To each one to retrieve the object's information again.