def _suggest_on_text(self, query): response = requests.post( f"{util.makeUrl(self.config.get('dah'))}/a=SuggestOnText&ResponseFormat=simplejson", data=util.aciQuery(query), verify=False) return response.json().get('autnresponse', {}).get('responsedata', {}).get('hit', [])
def _summarize_text(self, query): response = requests.post( f"{util.makeUrl(self.config.get('dah'))}/a=Summarize&ResponseFormat=simplejson", data=util.aciQuery(query), verify=False) response_data = response.json().get('autnresponse', {}).get('responsedata', {}) return response_data.get('summary', query.get('text', ''))
def _get_content(self, query): response = requests.post( f"{util.makeUrl(self.config.get('dah'))}/a=GetContent&ResponseFormat=simplejson", data=util.aciQuery(query), verify=False) hits = response.json().get('autnresponse', {}).get('responsedata', {}).get('hit', []) return hits[0] if len(hits) > 0 else None
def _query(self, query): response = requests.post( f"{util.makeUrl(self.config.get('dah'))}/a=Query&ResponseFormat=simplejson", data=util.aciQuery(query), verify=False) hits = response.json().get('autnresponse', {}).get('responsedata', {}).get('hit', []) return hits
def _get_statetoken(self, query): params = { 'Print': 'NoResults', 'StoreState': True, 'StoredStateField': 'DREREFERENCE', 'StoredStateTokenLifetime': 600 } response = requests.post( f"{util.makeUrl(self.config.get('dah'))}/a=Query&ResponseFormat=simplejson", data=util.aciQuery(query, params), verify=False) statetokeid = response.json().get('autnresponse', {}).get('responsedata', {}).get('state', '') self.logging.debug(f"Idol statetoke id: {statetokeid}") return statetokeid