did.py 文件源码

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

项目:rucio 作者: rucio01 项目源码 文件源码
def GET(self, scope):
        """
        List all data identifiers in a scope which match a given metadata.

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            404 KeyNotFound
            409 UnsupportedOperation

        :param scope: The scope name.
        """

        header('Content-Type', 'application/x-json-stream')
        filters = {}
        long = False
        if ctx.query:
            params = parse_qs(ctx.query[1:])
            for k, v in params.items():
                if k == 'type':
                    type = v[0]
                elif k == 'long':
                    long = bool(v[0])
                else:
                    filters[k] = v[0]

        try:
            for did in list_dids(scope=scope, filters=filters, type=type, long=long):
                yield dumps(did) + '\n'
        except UnsupportedOperation, error:
            raise generate_http_error(409, 'UnsupportedOperation', error.args[0][0])
        except KeyNotFound, error:
            raise generate_http_error(404, 'KeyNotFound', error.args[0][0])
        except Exception, error:
            print format_exc()
            raise InternalError(error)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号