pyresto icon indicating copy to clipboard operation
pyresto copied to clipboard

How to get list of objects?

Open aisbaa opened this issue 10 years ago • 4 comments

I'd like to know how should I retrieve a list of objects from api:

for user in GitHub.User.list():
    print user

GitHub.User.get() seems to be only working with dict objects from response.

P.S. Thank you for releasing this library!

aisbaa avatar Apr 09 '15 11:04 aisbaa

Hi there!

You should be able to get a list of users from another object like a Repo or some_user.followers etc. GitHub wouldn't reveal their whole user list :) I can help you more if you tell me what exactly you are trying to do (what is your final goal).

P.S. Thank you for releasing this library!

Haha, thanks for using it. It is sort of abandoned but still like my child :)

BYK avatar Apr 09 '15 11:04 BYK

Probably github added user listing later, it is available https://api.github.com/users . Wasn't doing anything special, don't even need such functionality for now, just first thing that I wanted to try. Any ways thanks for response!

aisbaa avatar Apr 09 '15 12:04 aisbaa

Oh, right!

I should add this. Tried GitHub.User.list = Many(GitHub.User, '/users?per_page=100', lazy=True) but it needs to be in an instance so I need some more time to make this work.

BYK avatar Apr 09 '15 13:04 BYK

Great, looking forward to see those changes!

aisbaa avatar Apr 10 '15 08:04 aisbaa