File tree 1 file changed +10
-2
lines changed
async_stripe/api_resources
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,11 @@ async def next_page_patch(
31
31
stripe_account = stripe_account ,
32
32
)
33
33
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
+ )
35
39
36
40
params_with_filters = self ._retrieve_params .copy ()
37
41
params_with_filters .update ({"starting_after" : last_id })
@@ -54,7 +58,11 @@ async def previous_page_patch(
54
58
stripe_account = stripe_account ,
55
59
)
56
60
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
+ )
58
66
59
67
params_with_filters = self ._retrieve_params .copy ()
60
68
params_with_filters .update ({"ending_before" : first_id })
You can’t perform that action at this time.
0 commit comments