Skip to content

Commit 33eb54f

Browse files
committed
Update code for next version
1 parent 21a0a98 commit 33eb54f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

async_stripe/api_resources/list_object.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ async def next_page_patch(
3131
stripe_account=stripe_account,
3232
)
3333

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

3640
params_with_filters = self._retrieve_params.copy()
3741
params_with_filters.update({"starting_after": last_id})
@@ -54,7 +58,11 @@ async def previous_page_patch(
5458
stripe_account=stripe_account,
5559
)
5660

57-
first_id = self.data[0].id
61+
first_id = getattr(self.data[0], "id")
62+
if not first_id:
63+
raise ValueError(
64+
"Unexpected: element in .data of list object had no id"
65+
)
5866

5967
params_with_filters = self._retrieve_params.copy()
6068
params_with_filters.update({"ending_before": first_id})

0 commit comments

Comments
 (0)