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 1
1
import json
2
2
from io import BytesIO
3
3
import tarfile
4
- from itertools import islice
5
4
from mailchimp_marketing .api import batches_api
6
5
import requests
7
6
from .decorators import no_batch
@@ -110,13 +109,14 @@ def run(self):
110
109
111
110
@no_batch
112
111
def bulk_run (self ):
113
- if len ( self .api_client .operations ) == 0 :
112
+ if self .api_client .operations == [] :
114
113
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 ]
117
116
batch_data = self .start ({"operations" : operations_chunk })
118
117
batch = Batch (self , operations = operations_chunk , ** batch_data )
119
118
self ._batches [batch .batch_id ] = batch
119
+ self .api_client .operations = self .api_client .operations [self ._max_operations :]
120
120
return self ._batches
121
121
122
122
def delete_all (self , refresh = False , ** kwargs ):
You can’t perform that action at this time.
0 commit comments