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

Example code for pagination results in unhandled exception #681

Open
brianz opened this issue Mar 5, 2024 · 0 comments
Open

Example code for pagination results in unhandled exception #681

brianz opened this issue Mar 5, 2024 · 0 comments
Labels

Comments

@brianz
Copy link

brianz commented Mar 5, 2024

Describe the bug

The documentation shows code examples on how to iterate around a paginated list of accounts/pages:

https://recurly-client-python.readthedocs.io/en/latest/#pagination

per-page

pages = client.list_accounts(limit=200).pages()
for page in pages:
    for account in page:
        print(account.code)

per-item

accounts = client.list_accounts(limit=200).items()
for account in accounts:
    print(account.code)

Both of these code examples fail:

Traceback (most recent call last):
  File "test-recurly.py", line 13, in <module>
    for page in pages:
  File "recurly/pager.py", line 40, in __next__
    page = self.__client._make_request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "recurly/base_client.py", line 51, in _make_request
    self._validate_options(options)
  File "recurly/base_client.py", line 103, in _validate_options
    raise ApiError(error, None)
recurly.base_errors.ApiError: Invalid options: limit. Allowed options: body, params, headers

To Reproduce

  • Create a valid recurly client with a valid API key according to the documentation.
  • Copy and paste the code examples mentioned above
  • Note that running it results in an exception with the error: Invalid options: limit. Allowed options: body, params, headers

Expected behavior

The code should run without errors

Your Environment

  • recurly==4.45.0
  • Python 3.12
  • MacOS
@brianz brianz added the bug? label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant