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

Search paging and exceeding limits #145

Closed
felix-hilden opened this issue Feb 9, 2020 · 2 comments · Fixed by #147
Closed

Search paging and exceeding limits #145

felix-hilden opened this issue Feb 9, 2020 · 2 comments · Fixed by #147
Assignees
Labels
bug Something isn't working

Comments

@felix-hilden
Copy link
Owner

When paging limits would allow for more items, but they run out, items can still be requested directly. Though their "next" attribute is None. Setting an arbitrarily large offset doesn't affect the call, so this cannot happen the other way around, except in search. So search paging limits function a bit differently. Like ordinary calls, items beyond the total may be requested. But the offset of search items is limited to 5000. The following raises 404 - Not Found on "next".

p, = spotify.search('piano', types=('playlist',), limit=50, offset=4950)
spotify.next(p)

There are a few situations where this can arise. And in each one we can try and return None if the call fails, or let it fail. I think we should try to base them on the behavior of other paging calls.

  • Direct call to search: other calls return a paging result with empty items, next: None and previous: link. I think we should let the error be raised, test it and document its existence.
  • Getting next page: other calls paging results have the next as None. Search should catch the error and return None as the others.
  • Getting all pages or items: other calls end when next is None. Search should too, through next.

So I'm proposing we should handle it in paging navigation, but let the error be raised in the direct call. Thoughts?

@felix-hilden felix-hilden added the consideration Future decision to be discussed label Feb 9, 2020
@felix-hilden felix-hilden self-assigned this Feb 9, 2020
@felix-hilden
Copy link
Owner Author

I think we'll handle it that way, effectively treating it like a bug in the Web API.

@felix-hilden felix-hilden added bug Something isn't working and removed consideration Future decision to be discussed labels Feb 10, 2020
@felix-hilden felix-hilden added the help wanted Extra attention is needed label Feb 15, 2020
@felix-hilden
Copy link
Owner Author

We have a solution, but a poor one. Help wanted: See associated PR.

@felix-hilden felix-hilden removed the help wanted Extra attention is needed label Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant