(xml)
return data
Parse incoming message XML

    Sample input:

        <?xml version="1.0" encoding="UTF-8" ?>
        <TRUMPIA>
            <PUSH_ID>1234561234567asdf123</PUSH_ID>
            <INBOUND_ID>9996663330001</INBOUND_ID>
            <SUBSCRIPTION_UID>987987987980</SUBSCRIPTION_UID>
            <PHONENUMBER>7777722222</PHONENUMBER>
            <KEYWORD>REPLY</KEYWORD>
            <CONTENTS><![CDATA[A sample reply message]]></CONTENTS>
            <ATTACHMENT />
        </TRUMPIA>

    Sample output:

        {
            "PUSH_ID": "1234561234567asdf123",
            "INBOUND_ID": "9996663330001",
            "SUBSCRIPTION_UID": "987987987980",
            "PHONENUMBER": "7777722222",
            "KEYWORD": "REPLY",
            "CONTENTS": "A sample reply message",
            "ATTACHMENT": "",
        }

    :returns: Dict of parsed data.
Parse incoming message XML
Parse incoming message XML
def parse_incoming(xml):
    """Parse incoming message XML

    Sample input:

        <?xml version="1.0" encoding="UTF-8" ?>
        <TRUMPIA>
            <PUSH_ID>1234561234567asdf123</PUSH_ID>
            <INBOUND_ID>9996663330001</INBOUND_ID>
            <SUBSCRIPTION_UID>987987987980</SUBSCRIPTION_UID>
            <PHONENUMBER>7777722222</PHONENUMBER>
            <KEYWORD>REPLY</KEYWORD>
            <CONTENTS><![CDATA[A sample reply message]]></CONTENTS>
            <ATTACHMENT />
        </TRUMPIA>

    Sample output:

        {
            "PUSH_ID": "1234561234567asdf123",
            "INBOUND_ID": "9996663330001",
            "SUBSCRIPTION_UID": "987987987980",
            "PHONENUMBER": "7777722222",
            "KEYWORD": "REPLY",
            "CONTENTS": "A sample reply message",
            "ATTACHMENT": "",
        }

    :returns: Dict of parsed data.
    """
    try:
        root = ElementTree.fromstring(xml)
    except (TypeError, ElementTree.ParseError):
        return {}
    data = {}
    for element in root:
        data[element.tag] = element.text
    return data
def parse_incoming ( xml ) : try : root = ElementTree . fromstring ( xml ) except ( TypeError , ElementTree . ParseError ) : return { } data = { } for element in root : data [ element . tag ] = element . text return data