File tree Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -357,27 +357,23 @@ def iter(self, **kwargs):
357
357
"""
358
358
Return all instance resources using an iterator
359
359
"""
360
- next_uri = self .uri
361
360
params = transform_params (kwargs )
362
361
363
- while next_uri :
364
- try :
365
- resp , page = self .request ("GET" , next_uri , params = params )
366
-
367
- if self .key not in page :
368
- raise StopIteration ()
362
+ while True :
363
+ resp , page = self .request ("GET" , self .uri , params = params )
369
364
370
- for ir in page [ self . key ] :
371
- yield self . load_instance ( ir )
365
+ if self . key not in page :
366
+ raise StopIteration ( )
372
367
373
- if not page . get ( 'next_page_uri' , '' ) :
374
- raise StopIteration ( )
368
+ for ir in page [ self . key ] :
369
+ yield self . load_instance ( ir )
375
370
376
- o = urlparse (page ['next_page_uri' ])
377
- params .update (parse_qs (o .query ))
378
- except TwilioRestException :
371
+ if not page .get ('next_page_uri' , '' ):
379
372
raise StopIteration ()
380
373
374
+ o = urlparse (page ['next_page_uri' ])
375
+ params .update (parse_qs (o .query ))
376
+
381
377
382
378
def load_instance (self , data ):
383
379
instance = self .instance (self , data [self .instance .id_key ])
You can’t perform that action at this time.
0 commit comments