@@ -232,7 +232,11 @@ def list_series(
232232 next_page = next_pagination .next_page
233233
234234 if attribute_to_extend_selected :
235- if next_pagination .items [0 ].series_id == paginated_response .items [- 1 ].series_id :
235+ try :
236+ first_item = next_pagination .items [0 ]
237+ except IndexError :
238+ break
239+ if first_item .series_id == paginated_response .items [- 1 ].series_id :
236240 # if series id is same, extract the first item and extend to last item
237241 continued_data : List = getattr (next_pagination .items .pop (0 ), attribute_to_extend_selected )
238242 previous_data : List = getattr (paginated_response .items [- 1 ], attribute_to_extend_selected )
@@ -585,7 +589,11 @@ def retrieve(
585589 next_page = next_pagination .next_page
586590
587591 if attribute_to_extend_selected :
588- if next_pagination .items [0 ].series_id == paginated_response .items [- 1 ].series_id :
592+ try :
593+ first_item = next_pagination .items [0 ]
594+ except IndexError :
595+ break
596+ if first_item .series_id == paginated_response .items [- 1 ].series_id :
589597 # if series id is same, extract the first item and extend to last item
590598 continued_data : List = getattr (next_pagination .items .pop (0 ), attribute_to_extend_selected )
591599 previous_data : List = getattr (paginated_response .items [- 1 ], attribute_to_extend_selected )
@@ -743,7 +751,11 @@ def retrieve_latest(
743751 next_page = next_pagination .next_page
744752
745753 if attribute_to_extend_selected :
746- if next_pagination .items [0 ].series_id == paginated_response .items [- 1 ].series_id :
754+ try :
755+ first_item = next_pagination .items [0 ]
756+ except IndexError :
757+ break
758+ if first_item .series_id == paginated_response .items [- 1 ].series_id :
747759 # if series id is same, extract the first item and extend to last item
748760 continued_data : List = getattr (next_pagination .items .pop (0 ), attribute_to_extend_selected )
749761 previous_data : List = getattr (paginated_response .items [- 1 ], attribute_to_extend_selected )
@@ -911,7 +923,11 @@ def retrieve_versioned(
911923 next_page = next_pagination .next_page
912924
913925 if attribute_to_extend_selected :
914- if next_pagination .items [0 ].series_id == paginated_response .items [- 1 ].series_id :
926+ try :
927+ first_item = next_pagination .items [0 ]
928+ except IndexError :
929+ break
930+ if first_item .series_id == paginated_response .items [- 1 ].series_id :
915931 # if series id is same, extract the first item and extend to last item
916932 continued_data : List = getattr (next_pagination .items .pop (0 ), attribute_to_extend_selected )
917933 previous_data : List = getattr (paginated_response .items [- 1 ], attribute_to_extend_selected )
0 commit comments