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

I am struggling to get .all() to return more than fifty items. #8

Open
bjntech opened this issue Oct 25, 2019 · 2 comments · May be fixed by #9
Open

I am struggling to get .all() to return more than fifty items. #8

bjntech opened this issue Oct 25, 2019 · 2 comments · May be fixed by #9

Comments

@bjntech
Copy link

bjntech commented Oct 25, 2019

Can you provide an example or look into the issue.
I expect api.jobcodes.all() to generate around four batches of fifty since my test data has around 200+ codes. However, it is stops at fifty no matter what.

for j in api.jobcodes.all():
#should loop 200+ times
#only ever loops fifty times.

@eturpin eturpin linked a pull request Nov 22, 2019 that will close this issue
@schir2
Copy link

schir2 commented Mar 5, 2020

I'm struggling to the all method to work period.

Maybe it's a python3 issue.

Either way I'm pretty sure your issue is linked to the way the base api works.

Under their docs you can get a max of 50 results per query. There is an option to request the next page, but I'm not sure if that part of this client is working.

There is a function called def _load_next_batch(self): in results.py file which might help you.

@schir2
Copy link

schir2 commented Mar 5, 2020

I think I figured out the issue.

To fix my issue of all() not working at all:

The function called next(self) should be renamed to __next__(self).
All references to that function should be renamed.

I didn't notice the fix to the limit to 50 issue above, and went ahead to try and figure it out.

To fix the issue with the all() not getting all the results the bridge.py file should be updated.
There is a line that says

result = {"items": self.items_from_data(data, name, is_singleton, mode),
        "has_more": (has_more == 'true')

That is a typo for the 'true'. That value is a bool not a string. It should say something like

has_more is True

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

Successfully merging a pull request may close this issue.

2 participants