licensors_handler.py 文件源码

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

项目:query-srv 作者: openpermissions 项目源码 文件源码
def get(self):
        """
        Retrieve licensors
        """
        source_id_type = self.get_argument('source_id_type', None)
        source_id = self.get_argument('source_id', None)
        if not source_id_type or not source_id:
            raise HTTPError(400, 'Must have "source_id_type" and "source_id" parameters')

        try:
            translated_id = common.translate_id_pair(
                {'source_id_type': source_id_type, 'source_id': source_id})
        except ValueError:
            raise HTTPError(400, '{} is an invalid hub key'.format(source_id))

        try:
            result = yield licensors.get_asset_licensors(
                translated_id['source_id_type'],
                translated_id['source_id']
            )
            self.finish(result)
        except httpclient.HTTPError as exc:
            body = json.loads(exc.response.body)
            raise HTTPError(exc.response.code, body)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号