python-zeep
python-zeep copied to clipboard
MIME multipart encapsulation for sending attachments
Added a multipart encapsulation for sending attachments to a SOAP server.
Some examples of the current public facing API for attachments:
client = zeep.Client("wsdl-string")
client.service.wsdlService(param0, param1, attachments=[open("attachment-file", "rb")]))
The attachments
kwarg attempts to make it as easy as possible for users to attach files to the request. You can pass an attachment any of the following ways
attachments = [open("attachment-file", "rb")]
attachments = [("attachment-content-id.txt", b"Binary encoding. Assumed utf-8")]
attachments = [("attachment-content-id.txt", b"Binary encoding...", "utf-8")]
attachments = [
AttachmentEncodable(
name="attachment-encoded.txt",
data=b"Binary encoding...",
content_type="utf-8",
transfer_encoding="8bit",
)
]