File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 11import json
22from io import BytesIO
33import tarfile
4- from itertools import islice
54from mailchimp_marketing .api import batches_api
65import requests
76from .decorators import no_batch
@@ -110,13 +109,14 @@ def run(self):
110109
111110 @no_batch
112111 def bulk_run (self ):
113- if len ( self .api_client .operations ) == 0 :
112+ if self .api_client .operations == [] :
114113 raise Exception ("No operations to run" )
115- operations = iter ( self .api_client .operations )
116- while operations_chunk := list ( islice ( operations , self ._max_operations )):
114+ while self .api_client .operations :
115+ operations_chunk = self . api_client . operations [: self ._max_operations ]
117116 batch_data = self .start ({"operations" : operations_chunk })
118117 batch = Batch (self , operations = operations_chunk , ** batch_data )
119118 self ._batches [batch .batch_id ] = batch
119+ self .api_client .operations = self .api_client .operations [self ._max_operations :]
120120 return self ._batches
121121
122122 def delete_all (self , refresh = False , ** kwargs ):
You can’t perform that action at this time.
0 commit comments