Coverage for coherence/upnp/core/soap_lite.py : 94%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# Licensed under the MIT license # http://opensource.org/licenses/mit-license.php
# Copyright 2007 - Frank Scholz <coherence@beebits.net>
some simple functions to implement the SOAP msgs needed by UPnP with ElementTree
inspired by ElementSOAP.py """
str: 'string', bytes: 'bytes', int: 'int', float: 'float', bool: 'boolean'}
401: 'Invalid Action', 402: 'Invalid Args', 501: 'Action Failed', 600: 'Argument Value Invalid', 601: 'Argument Value Out of Range', 602: 'Optional Action Not Implemented', 603: 'Out Of Memory', 604: 'Human Intervention Required', 605: 'String Argument Too Long', 606: 'Action Not Authorized', 607: 'Signature Failure', 608: 'Signature Missing', 609: 'Not Encrypted', 610: 'Invalid Sequence', 611: 'Invalid Control URL', 612: 'No Such Session', }
description='without words', pretty_print=True): """ builds an UPnP SOAP error msg """ nsmap={None: NS_UPNP_ORG_CONTROL_1_0}) description)
is_response=False, pretty_print=True): """ create a shell for a SOAP request or response element - set method to none to omitt the method element and add the arguments directly to the body (for an error msg) - arguments can be a dict or an etree.Element """ etree.QName(NS_SOAP_ENV, 'Envelope'), attrib={etree.QName(NS_SOAP_ENV, 'encodingStyle'): NS_SOAP_ENC}, nsmap={'s': NS_SOAP_ENV}) envelope, etree.QName(NS_SOAP_ENV, 'Body'))
else: tag = method nsmap = None
else:
# append the arguments arg_val = arg_val.decode('utf-8') # elif isinstance(arg_val, ELEMENT_TYPE): # e.append(arg_val)
pretty_print=pretty_print) |