With AsyncClient, passing multiple attachments under the same key fails with a malformed attachment object error. The same payload works with the synchronous Client, so the async file-handling logic differs. Version 1.6.0, Linux, Python 3.12.
With AsyncClient, passing multiple attachments under the same key fails with a malformed attachment object error. The same payload works with the synchronous Client, so the async file-handling logic differs. Version 1.6.0, Linux, Python 3.12.
AsyncClient used different file-handling logic than the sync Client and mangled repeated keys. The maintainer fixed it in PR #35, so upgrading to the release containing that fix resolves it. Workarounds for the affected version: use unique keys ("inline[0]", "inline[1]" instead of "inline" twice), or pass the attachments as a tuple of tuples rather than a list of tuples, which bypasses the SDK's dict/list checks and hands the object to requests verbatim. The reporter confirmed unique keys work. Source: https://github.com/mailgun/mailgun-python/issues/33
Source: https://github.com/mailgun/mailgun-python/issues/33