def get_status(dom):
        """
        Gets Status from a Response.

        :param dom: The Response as XML
        :type: Document

        :returns: The Status, an array with the code and a message.
        :rtype: dict
        """
        status = {}

        status_entry = OneLogin_Saml2_Utils.query(dom, '/samlp:Response/samlp:Status')
        if len(status_entry) != 1:
            raise OneLogin_Saml2_ValidationError(
                'Missing Status on response',
                OneLogin_Saml2_ValidationError.MISSING_STATUS
            )

        code_entry = OneLogin_Saml2_Utils.query(dom, '/samlp:Response/samlp:Status/samlp:StatusCode', status_entry[0])
        if len(code_entry) != 1:
            raise OneLogin_Saml2_ValidationError(
                'Missing Status Code on response',
                OneLogin_Saml2_ValidationError.MISSING_STATUS_CODE
            )
        code = code_entry[0].values()[0]
        status['code'] = code

        status['msg'] = ''
        message_entry = OneLogin_Saml2_Utils.query(dom, '/samlp:Response/samlp:Status/samlp:StatusMessage', status_entry[0])
        if len(message_entry) == 0:
            subcode_entry = OneLogin_Saml2_Utils.query(dom, '/samlp:Response/samlp:Status/samlp:StatusCode/samlp:StatusCode', status_entry[0])
            if len(subcode_entry) == 1:
                status['msg'] = subcode_entry[0].values()[0]
        elif len(message_entry) == 1:
            status['msg'] = OneLogin_Saml2_Utils.element_text(message_entry[0])

        return status
def get_status ( dom ) : status = { } status_entry = OneLogin_Saml2_Utils . query ( dom , '/samlp:Response/samlp:Status' ) if len ( status_entry ) != 1 : raise OneLogin_Saml2_ValidationError ( 'Missing Status on response' , OneLogin_Saml2_ValidationError . MISSING_STATUS ) code_entry = OneLogin_Saml2_Utils . query ( dom , '/samlp:Response/samlp:Status/samlp:StatusCode' , status_entry [ 0 ] ) if len ( code_entry ) != 1 : raise OneLogin_Saml2_ValidationError ( 'Missing Status Code on response' , OneLogin_Saml2_ValidationError . MISSING_STATUS_CODE ) code = code_entry [ 0 ] . values ( ) [ 0 ] status [ 'code' ] = code status [ 'msg' ] = '' message_entry = OneLogin_Saml2_Utils . query ( dom , '/samlp:Response/samlp:Status/samlp:StatusMessage' , status_entry [ 0 ] ) if len ( message_entry ) == 0 : subcode_entry = OneLogin_Saml2_Utils . query ( dom , '/samlp:Response/samlp:Status/samlp:StatusCode/samlp:StatusCode' , status_entry [ 0 ] ) if len ( subcode_entry ) == 1 : status [ 'msg' ] = subcode_entry [ 0 ] . values ( ) [ 0 ] elif len ( message_entry ) == 1 : status [ 'msg' ] = OneLogin_Saml2_Utils . element_text ( message_entry [ 0 ] ) return status
Gets Status from a Response.

        :param dom: The Response as XML
        :type: Document

        :returns: The Status, an array with the code and a message.
        :rtype: dict