71 def get_data(host, query, idx, limit, debug):
72 """Contact DAS server and retrieve data for given DAS query""" 73 params = {
'input':query,
'idx':idx,
'limit':limit}
75 pat = re.compile(
'http[s]{0,1}://')
76 if not pat.match(host):
77 msg =
'Invalid hostname: %s' % host
80 headers = {
"Accept":
"application/json"}
81 encoded_data = urllib.urlencode(params, doseq=
True)
82 url +=
'?%s' % encoded_data
83 req = urllib2.Request(url=url, headers=headers)
85 hdlr = urllib2.HTTPHandler(debuglevel=1)
86 opener = urllib2.build_opener(hdlr)
88 opener = urllib2.build_opener()
89 fdesc = opener.open(req)
93 pat = re.compile(
r'^[a-z0-9]{32}')
94 if data
and isinstance(data, str)
and pat.match(data)
and len(data) == 32:
101 params.update({
'pid':data})
102 encoded_data = urllib.urlencode(params, doseq=
True)
103 url = host + path +
'?%s' % encoded_data
104 req = urllib2.Request(url=url, headers=headers)
106 fdesc = opener.open(req)
109 except urllib2.HTTPError
as err:
112 if data
and isinstance(data, str)
and pat.match(data)
and len(data) == 32:
def get_data(host, query, idx, limit, debug)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)