0
votes

A python rookie here and thank you for taking time to help.

I am sending a SOAP request to download some mp4 recordings from a server using zeep. The server responds by sending the following MessagePack attachments. How do I unpack this and convert to mp4. The multi-part attachment has both the decsription of the file and the actual MP4 file itself. Thanks

<MessagePack(attachments=[<Attachment('<6X3ER09X000X401BEFX91B4FFBD48906>', 'application/octet-stream')>, <Attachment('<0XECXX28CX0RS9DD28BYYA9F2CBA177D>', 'application/octet-stream')>])>

Here is the code I am trying to use

def get_record(client, siteid, username, passwd, ticket):
    return client.downloadNBRStorageFile(**{'siteId': 'xxxxx', 'recordId': xxxxx, 'ticket':ticket})

def main():

client = Client(wsdl=wsdl)
service = client.create_service(BINDING_NAME, ADDRESS)
resp = update_phone_by_name(service, siteid, username, password, ticket)
pack = client.service.downloadNBRStorageFile
recording = pack.root
description = pack.attachments[0].content
rec_file = pack.attachments[1].content

When I run this I get this error "recording = pack.root AttributeError: 'OperationProxy' object has no attribute 'root'"

I am trying to do the same as this post but unable to figure out how to download the attachments

Python SOAP WSDL works in SOAPpy but not ZSI or zeep

----Edit-----Update----- I have updated the code as below:

def get_ticket(client):
    global rec_ticket
    global ticket
    rec_ticket = client.getStorageAccessTicket(**{'siteId': siteid, 'username': username, 'password': password})
    return rec_ticket

def get_record(client):
    return client.downloadNBRStorageFile(**{'siteId': 'xxxxx', 'recordId': 

recordid, 'ticket':rec_ticket})

def main():
    client = Client(wsdl=wsdl)
    axl = client.create_service(BINDING_NAME, ADDRESS)
    resp_ticket = get_ticket(axl)
    resp_rec = get_record(axl)
    pack = client.service.downloadNBRStorageFile(siteid, recordID, rec_ticket)

    record_details = pack.root
    record_file = pack.attachments[1].content

However I get the response below: " raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='10.224.91.216', port=2001): Max retries exceeded with url: /nbr/services/NBRStorageService (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'))"

1
What have you tried so far? Have you read through the zeep documentation? There is some example code in the docs. - larsks
Thanks larsks. I have looked at that doc but it does not help or I cant seem to understand how to apply it to this scenario. I have updatedmy question to include the code I am trying to use and the error I am getting - Dejoskii
Can anyone please help out here. - Dejoskii

1 Answers

0
votes

You're not actually calling client.service.downloadNBRStorageFile. To actually call the method, you would need:

pack = client.service.downloadNBRStorageFile()

(Note the parentheses on the end.)

Your current code is simply assigning the client.service.downloadNBRStorageFile object to your pack variable, which is why your error message refers to an OperationProxy type.