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

_paginate_iter throws KeyError #467

Closed
oboxer opened this issue Jul 4, 2023 · 3 comments
Closed

_paginate_iter throws KeyError #467

oboxer opened this issue Jul 4, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@oboxer
Copy link

oboxer commented Jul 4, 2023

Describe the bug

_paginate_iter throws KeyError: 'results' when results doesn't exist in resp

To Reproduce

Call list_aggs with "/v2/aggs/ticker/O:SPY230703C00408000/range/5/minute/2023-07-03/2023-07-04"

Expected behavior

IMHO, this is not an error. When there's no results in resp, just skip it, don't throw a key error.
Change for t in decoded[result_key]: to for t in decoded.get(result_key, []): should be enough

Screenshots

N/A

Additional context

N/A

@oboxer oboxer added the bug Something isn't working label Jul 4, 2023
@justinpolygon justinpolygon self-assigned this Jul 5, 2023
@justinpolygon
Copy link
Contributor

Hey, thanks for submitting this @oboxer. I'll check it out.

@justinpolygon
Copy link
Contributor

This is fixed via #483 and we'll return an empty array if not results are found. I'll cut a new release shortly. Thanks again for reporting this. I'll followup when the release is out.

@justinpolygon
Copy link
Contributor

We have released v1.12.0 that fixes this issue and returns and empty array when no results are found.

Please see https://github.com/polygon-io/client-python/releases/tag/v1.12.0

Thanks again for reporting this and helping up improve the library.

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

No branches or pull requests

2 participants