def query(self,q,limit=None,graph=None):
params = {'query':str(q)}
if limit is not None:
params['limit'] = limit
if graph is not None:
params['context'] = '<' + graph + '>'
#print(str(q))
req = requests.get(self.endpoints['query'],params=params,headers={'accept':'application/json'},auth=self.auth)
if (req.status_code>=200 or req.status_code<300):
data = json.loads(req.text)
return data
else:
raise IOError('Cannot query to uri <{}>, status={}'.format(self.service,req.status_code))
评论列表
文章目录