Beispiel #1
0
 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', [])
Beispiel #2
0
 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', ''))
Beispiel #3
0
 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
Beispiel #4
0
 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
Beispiel #5
0
 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