File indexing completed on 2024-11-25 02:29:10
0001 from das_client import get_data
0002 import subprocess
0003
0004
0005 def query(query_str, verbose=False):
0006 'simple query function to interface with DAS, better than using Popen as everything is handled by python'
0007 if verbose:
0008 print('querying DAS with: "%s"' % query_str)
0009 data = get_data(
0010 'https://cmsweb.cern.ch',
0011 query_str,
0012 0, 0, False)
0013
0014 to_get = query_str.split()[0].strip(',')
0015 if data['status'] != 'ok':
0016 raise RuntimeError('Das query crashed')
0017
0018
0019
0020 return [i[to_get][-1]['name'] for i in data['data']]