Skip to content

Commit bfd1168

Browse files
committed
Attempt to fix type error
The error: ``` Error: Argument of type "dict[str, int]" cannot be assigned to parameter "value" of type "str" in function "__setitem__" "dict[str, int]" is not assignable to "str" (reportArgumentType) ```
1 parent d3d0e1d commit bfd1168

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

wagtail_newsletter/campaign_backends/mailchimp.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,16 @@ def get_campaign_request_body(
203203
}
204204

205205
if recipients is not None:
206-
body["recipients"] = {
206+
recipients_mapping: dict[str, Any] = {
207207
"list_id": recipients.audience,
208208
}
209209

210210
if recipients.segment:
211211
segment_id = int(recipients.segment.split("/")[1])
212-
body["recipients"]["segment_opts"] = {
212+
recipients_mapping["segment_opts"] = {
213213
"saved_segment_id": segment_id,
214214
}
215+
body["recipients"] = recipients_mapping
215216

216217
return body
217218

0 commit comments

Comments
 (0)