Skip to content
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

Users: Handle the case there are more than 100 results #19

Open
werdeil opened this issue Jul 15, 2019 · 2 comments
Open

Users: Handle the case there are more than 100 results #19

werdeil opened this issue Jul 15, 2019 · 2 comments

Comments

@werdeil
Copy link

werdeil commented Jul 15, 2019

My apologies if it is already handled, but I didn't found how to do it in the code.

When I want my discourse users, client.users() only gives me the first 100 users whereas I have more than 100.

I've looked at the doc and it seems that the API doesn't tell that there are more users, but we can use the "page" param to get the next ones.

I guess the solution would be to loop on the pages until the call gives an empty list as a result.

I'll try to do a PR if I manage to find a solution.

@goetzk
Copy link
Collaborator

goetzk commented Jul 15, 2019

The simple work around / solution is to check if you had 100 users returned and try another download. I usually do something like this:

counter = 1
while counter:
 downloaded_things = download_things
 counter = len(downloaded_things)

When it stops returning results it breaks out (sorry , I can't look up a real example right now).

@bennylope
Copy link
Collaborator

bennylope commented Jul 15, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants