8000 GitHub.repository objs returned by gh.iter_all_repos() missing created_at (and other) fields · Issue #760 · sigmavirus24/github3.py · GitHub
[go: up one dir, main page]

Skip to content
8000

GitHub.repository objs returned by gh.iter_all_repos() missing created_at (and other) fields #760

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

Closed
bhazard opened this issue Jan 1, 2018 · 4 comments

Comments

@bhazard
Copy link
bhazard commented Jan 1, 2018

The repository (generator) object returned via the iter_all_repos is missing some fields (created_at, archived, maybe others).

ir = gh.iter_all_repos(number=1, since=72013299-1)
for r in ir:
    print(r.full_name)
    print(r.created_at)
    print(r.id)

Outputs:

bohao-cao/Tutorial
None
72013299

And if I access directly via:

r2 = gh.repository('bohao-cao','Tutorial')
print(r2.full_name)
print(r2.created_at)
print(r2.id)

Produces:

bohao-cao/Tutorial
2016-10-26 14:47:29+00:00
72013299

On a quick looks, seems that other attributes may be missing as well. For example, archived.
I have verified with my own repositories, public/private as well as the public repo used in this example.

Version is github3.py 0.9.6
Python 3.6.3

@omgjlk
Copy link
Collaborator
omgjlk commented Jan 2, 2018

Hi! I believe this is due to some refactoring of the objects we've been doing in the develop branch. When iterating an object like repositories the GitHub API returns a smaller partial set of data. We've turned these into "Short" objects and represent just the data that has been returned. Once you have a Short object, you should be able to call a refresh() method on it (repo = repo.refresh()) to turn it into the full object with all the details (of course that will incur another API hit).

Does that make sense? There's a bunch more details in #670 . Let me know if this resolves your issues!

@bhazard
Copy link
Author
bhazard commented Jan 2, 2018

Thanks, Jesse!
Yeah, I figured it was something like that (but was hoping to save an API call ... :( ). So maybe just addressing in doc?
Bill

@omgjlk
Copy link
Collaborator
omgjlk commented Jan 2, 2018

Yes, I believe we need to update the docs for this stuff.

Prior to refactoring the code, you'd wind up with a Repository object that would have the missing attributes, but they'd all be set to some equivalent to None, since that data just isn't in the API return from iterating. Only it was less clear that the attribute data needed to be fetched, rather than just being empty.

@sigmavirus24
Copy link
Owner

For the record iter_all_repos is in 0.9. To get the new behaviour you'd have to be on code from develop which hasn't been released yet

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

3 participants
0