1 from commands
import getstatusoutput
3 from das_client
import get_value
as das_get_value
6 return das_get_value(data, filters, base)
8 def get_data(query, limit=None, threshold=None, idx=None, host=None):
9 cmd_opts =
"--format=json"
10 if threshold
is not None: cmd_opts +=
" --threshold=%s" % threshold
11 if limit
is not None: cmd_opts +=
" --limit=%s" % limit
12 if idx
is not None: cmd_opts +=
" --idx=%s" % idx
13 if host
is not None: cmd_opts +=
" --host=%s" % host
14 err, out = getstatusoutput(
"das_client %s --query '%s'" % (cmd_opts, query))
15 if not err:
return loads(out)
16 return {
'status' :
'error',
'reason' : out}