Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Zeep support attachments?

Does Python SOAP client library Zeep support attachments?

I could not really find anything in the documentation.

The idea is to send a SOAP request in XML format, with some attached files. I guess the regular way of doing this is a multipart message, which seems to be suppored by requests, upon which Zeep is built.

like image 869
Pintun Avatar asked Dec 31 '25 01:12

Pintun


1 Answers

You can subclass Transport class and override the post_xml method to modify the envelope attach multipart files. I just finihed a silly module (based on this post How to send Multipart/related requests in Python to SOAP server?) that does the trick.

https://github.com/ellethee/python-zeep/blob/master/src/zeep/transport_with_attach.py

hope it can help.

like image 96
ellethee Avatar answered Jan 01 '26 16:01

ellethee