Create segment through Python SDK

ele

Member
Hello, Trying to implement the missing create() method about ListSegments to extend the Python SDK, I discovered that the current internal of MailWizz doesn't support the nested Python structure (list of dictionaries in a dictionary) which should be passed to the POST request to mimic the way it's done in the PHP SDK. I opened (and closed) a ticket about this in the GitHub repository.

Well, not an extension in the strict sense of a "plugin", but maybe an extension of the Python SDK (however, feel free to move this post where you think it should be in the forum, of course)... I'll write a helper function to manage this case and allow a nested payload today... And I'll paste it over there, in the GitHub's ticket, if it works well. ;)

--
EDIT : Done! The fix is on GitHub in the linked ticket.
 
Last edited:
Hello,
We are not python developers mainly. I remember that when I wrote the client I had to handle this kind of nested dictionary. Take a look at Base._prepare_body. There are endpoints where I had to overwrite that method.

Cosmin
 
  • Like
Reactions: ele
No problem, Cosmin, it's solved! I also (like you) ended up adding a "grinder" (posted at the end of the GitHub ticket) to flatten the structure passed to the POST request (upfront, before the _prepare_body's job).
 
Back
Top