3

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.

Pintun
  • 716
  • 1
  • 7
  • 23

1 Answers1

0

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.

Community
  • 1
  • 1
ellethee
  • 161
  • 2
  • 8