Skip to content

Commit 967f2e0

Browse files
committed
Address review comments
1 parent 33055b5 commit 967f2e0

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

rapid_pro_tools/rapid_pro_client.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def send_message_to_urn(self, message, target_urn, interrupt=False):
273273

274274
log.info("Sending a message to an individual...")
275275
log.debug(f"Sending to '{target_urn}' the message '{message}'...")
276-
response: Broadcast = self.rapid_pro.create_broadcast(message, urns=[target_urn])
276+
response = self.rapid_pro.create_broadcast(message, urns=[target_urn])
277277
log.info(f"Message send request created with broadcast id {response.id}")
278278
return response.id
279279

@@ -295,7 +295,7 @@ def send_message_to_urns(self, message, target_urns, interrupt=False):
295295
log.info(f"Sending a message to {len(urns)} URNs...")
296296
log.debug(f"Sending to {urns}...")
297297
batch = []
298-
ids = []
298+
broadcast_ids = []
299299
interrupted = 0
300300
sent = 0
301301

@@ -307,22 +307,20 @@ def send_message_to_urns(self, message, target_urns, interrupt=False):
307307
interrupted += len(batch)
308308
log.info(f"Interrupted {interrupted} / {len(urns)} URNs")
309309

310-
response: Broadcast = self.rapid_pro.create_broadcast(message, urns=batch)
311-
ids.append(response.id)
310+
response = self.rapid_pro.create_broadcast(message, urns=batch)
311+
broadcast_ids.append(response.id)
312312
sent += len(batch)
313313
batch = []
314+
log.info(f"Sent {sent} / {len(urns)} URNs")
314315
if len(batch) > 0:
315316
if interrupt:
316317
self.rapid_pro.bulk_interrupt_contacts(batch)
317318
interrupted += len(batch)
318319
response: Broadcast = self.rapid_pro.create_broadcast(message, urns=batch)
319320
sent += len(batch)
320-
321-
ids.append(response.id)
322-
323-
324-
log.info(f"Interrupted {interrupted} / {len(urns)} URNs")
325-
log.info(f"Sent {sent} / {len(urns)} URNs")
321+
broadcast_ids.append(response.id)
322+
log.info(f"Interrupted {interrupted} / {len(urns)} URNs")
323+
log.info(f"Sent {sent} / {len(urns)} URNs")
326324

327325
log.info(f"Message send request created with broadcast ids {ids}")
328326
return ids

0 commit comments

Comments
 (0)