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)
评论列表
文章目录