Closed isidrov closed 7 years ago
Does Zeep support Multipart responses? It does seem the response is not categorized as MIME
I have added multipart response support via https://github.com/mvantellingen/python-zeep/pull/302
@isidrov could you give the master branch a try? Should be supported now
Hello mvantellingen,
I might be doing something wrong, I will check again tomorrow but below are my observations
With #302 , after calling the Soap method I was retrieving the file in bytes as
pack = dime_client.service.GetOneFile('/var/log/active/log') pack = pack[1].content
It would save it locally no matter the extension
https://dl.dropboxusercontent.com/u/39392000/debug_%23302_attachment.png
Now with the latest code to get the same bytes I need:
pack = pack.attachments[0]._part.content
https://dl.dropboxusercontent.com/u/39392000/debug_0.27_attachment.png
I am guessing it is not intended to be there however attachments.data (BytesIO object) seems empty
Also I could only make it work with log files and not with gzip files, which I get the below:
header: X-Frame-Options header: Set-Cookie header: Content-Type header: Transfer-Encoding header: Date header: Server Traceback (most recent call last):
File "/Users//PycharmProjects/cola/zeepVLC.py", line 302, in
Thanks
Should be fixed in master.
It works nicely thanks! Tested both; text files and gzip. One thing I noticed is to access directly to the attachment through 'attachments' list, e.g. pack.attachments[0] - data attribute is not there or needed. If this is the intention I think is perfect although the data portion is still described in the documentation.
Ah yeah, it's pack.attachments[0].content now. I'll update the docs. See https://github.com/mvantellingen/python-zeep/blob/master/src/zeep/wsdl/attachments.py for the interface
Hi,
Version: zeep==0.24.0
WSDL: https://gist.github.com/isidrov/4016ff1baee7b879df200d50908880ce
sample script: https://gist.github.com/isidrov/d8b8bbf7993921f47d0e88d2450525ae
This method downloads a file as MIME. When enabling logging I can see the request going through, 200 response and through logging the content of the file, however, presumably before the full file is read the below error appears:
Traceback (most recent call last): File "/Users//PycharmProjects/Sparkify/toDelete.py", line 26, in
FileContent = dime_client.service.GetOneFile('/var/log/active/syslog/AlternateSyslog')
File "/usr/local/lib/python3.5/site-packages/zeep/client.py", line 41, in call
self._op_name, args, kwargs)
File "/usr/local/lib/python3.5/site-packages/zeep/wsdl/bindings/soap.py", line 113, in send
return self.process_reply(client, operation_obj, response)
File "/usr/local/lib/python3.5/site-packages/zeep/wsdl/bindings/soap.py", line 132, in process_reply
doc = parse_xml(response.content, recover=True)
File "/usr/local/lib/python3.5/site-packages/zeep/parser.py", line 13, in parse_xml
return fromstring(content, parser=parser, base_url=base_url)
File "/usr/local/lib/python3.5/site-packages/defusedxml/lxml.py", line 141, in fromstring
elementtree = rootelement.getroottree()
AttributeError: 'NoneType' object has no attribute 'getroottree'
The same request through SOAPUI works and I can download the file of 3.9 MB
Request through SOAPUI looks like the below: