recurly / recurly-client-python

Recurly Python Client
https://developers.recurly.com
MIT License
92 stars 78 forks source link

Example code for pagination results in unhandled exception #681

Open brianz opened 7 months ago

brianz commented 7 months ago

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

Expected behavior

The code should run without errors

Your Environment