lti.py 文件源码

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

项目:CodeGra.de 作者: CodeGra-de 项目源码 文件源码
def post_replace_result(
        self, score: str, result_data: t.Mapping[str, str] = None
    ) -> 'OutcomeResponse':
        '''
        POSTs the given score to the Tool Consumer with a replaceResult.

        OPTIONAL:
            result_data must be a dictionary
            Note: ONLY ONE of these values can be in the dict at a time,
            due to the Canvas specification.

        :param str text: text
        :param str url: url
        :param str launchUrl: The lti launch url
        '''
        self.operation = REPLACE_REQUEST
        self.score = score
        self.result_data = result_data
        if result_data is not None:
            if len(result_data) > 1:
                error_msg = (
                    'Dictionary result_data can only have one entry. '
                    '{0} entries were found.'.format(len(result_data))
                )
                raise ValueError(error_msg)
            elif any(a in result_data for a in ['url', 'text', 'launchUrl']):
                return self.post_outcome_request()
            else:
                error_msg = (
                    'Dictionary result_data can only have the key '
                    '"text" or the key "url".'
                )
                raise ValueError(error_msg)
        else:
            return self.post_outcome_request()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号