lti.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:CodeGra.de 作者: CodeGra-de 项目源码 文件源码
def process_xml(self, xml: str) -> None:
        '''
        Parse Outcome Request data from XML.
        '''
        root = t.cast(t.Mapping, objectify.fromstring(xml))
        self.message_identifier = str(
            root['imsx_POXHeader']['imsx_POXRequestHeaderInfo']
            ['imsx_messageIdentifier']
        )
        try:
            result = root['imsx_POXBody']['replaceResultRequest']
            self.operation = REPLACE_REQUEST
            # Get result sourced id from resultRecord
            self.lis_result_sourcedid = result.resultRecord.\
                sourcedGUID.sourcedId
            self.score = str(result.resultRecord.result.resultScore.textString)
        except (KeyError, TypeError, AttributeError):
            pass

        try:
            result = root['imsx_POXBody']['deleteResultRequest']
            self.operation = DELETE_REQUEST
            # Get result sourced id from resultRecord
            self.lis_result_sourcedid = result['resultRecord']['sourcedGUID'
                                                               ]['sourcedId']
        except (KeyError, TypeError):
            pass

        try:
            result = root['imsx_POXBody']['readResultRequest']
            self.operation = READ_REQUEST
            # Get result sourced id from resultRecord
            self.lis_result_sourcedid = result['resultRecord']['sourcedGUID'
                                                               ]['sourcedId']
        except (KeyError, TypeError):
            pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号