Skip to content

Commit 91544bf

Browse files
committed
These useful things shouldn’t be private
1 parent 66c0faf commit 91544bf

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

batch_mailchimp/batches_api.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,21 @@ def __init__(self, batches_api, **kwargs):
3232

3333
def update(self, **kwargs):
3434
self.batch_id = kwargs.get("id")
35+
self.total_operations = kwargs.get("total_operations")
36+
self.finished_operations = kwargs.get("finished_operations")
37+
self.errored_operations = kwargs.get("errored_operations")
38+
self.submitted_at = kwargs.get("submitted_at")
39+
self.completed_at = kwargs.get("completed_at")
40+
self.response_body_url = kwargs.get("response_body_url")
3541
self._status = kwargs.get("status")
36-
self._total_operations = kwargs.get("total_operations")
37-
self._finished_operations = kwargs.get("finished_operations")
38-
self._errored_operations = kwargs.get("errored_operations")
39-
self._submitted_at = kwargs.get("submitted_at")
40-
self._completed_at = kwargs.get("completed_at")
41-
self._response_body_url = kwargs.get("response_body_url")
4242

4343
def __repr__(self):
44-
return "<{module}.{name}: {total} operation{s} ({status})>".format(
44+
return "<{module}.{name}: {finished}/{total} operation{s} ({status})>".format(
4545
module=self.__class__.__module__,
4646
name=self.__class__.__name__,
47-
total=self._total_operations,
48-
s="s" if self._total_operations != 1 else "",
47+
finished=self.finished_operations,
48+
total=self.total_operations,
49+
s="s" if self.total_operations != 1 else "",
4950
status=self._status,
5051
)
5152

@@ -58,8 +59,8 @@ def response(self):
5859
if self.response:
5960
return self.response
6061
batch = self.status(refresh=True)
61-
if batch._status == "finished" and batch._response_body_url:
62-
content = requests.get(batch._response_body_url).content
62+
if batch._status == "finished" and batch.response_body_url:
63+
content = requests.get(batch.response_body_url).content
6364
tf = tarfile.open(fileobj=BytesIO(content))
6465
output = []
6566
for member in tf.getmembers():

0 commit comments

Comments
 (0)