Skip to content

Commit

Permalink
Update code for next version
Browse files Browse the repository at this point in the history
  • Loading branch information
bhch committed Dec 3, 2023
1 parent 21a0a98 commit 33eb54f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions async_stripe/api_resources/list_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ async def next_page_patch(
stripe_account=stripe_account,
)

last_id = self.data[-1].id
last_id = getattr(self.data[-1], "id")
if not last_id:
raise ValueError(
"Unexpected: element in .data of list object had no id"
)

params_with_filters = self._retrieve_params.copy()
params_with_filters.update({"starting_after": last_id})
Expand All @@ -54,7 +58,11 @@ async def previous_page_patch(
stripe_account=stripe_account,
)

first_id = self.data[0].id
first_id = getattr(self.data[0], "id")
if not first_id:
raise ValueError(
"Unexpected: element in .data of list object had no id"
)

params_with_filters = self._retrieve_params.copy()
params_with_filters.update({"ending_before": first_id})
Expand Down

0 comments on commit 33eb54f

Please sign in to comment.