| 37 | @aiohttp_apispec.response_schema(FactSchema(many=True, partial=True), |
| 38 | description='Returns a list of matching facts, dumped in `FactSchema` format.') |
| 39 | async def get_facts(self, request: web.Request): |
| 40 | fact_data = await self._api_manager.extract_data(request) |
| 41 | resp = [] |
| 42 | if fact_data: |
| 43 | try: |
| 44 | resp = await self._find_and_verify_facts(fact_data) |
| 45 | except Exception as e: |
| 46 | error_msg = f'Encountered issue retrieving fact {fact_data} - {e}' |
| 47 | self.log.warning(error_msg) |
| 48 | raise JsonHttpBadRequest(error_msg) |
| 49 | return web.json_response(dict(found=resp)) |
| 50 | |
| 51 | @aiohttp_apispec.docs(tags=['facts'], |
| 52 | summary='Retrieve Facts by operation id', |