| from api.core.app import Demos | |
| __main = Demos() | |
| api = __main.api() | |
| def get_text_from_url(data:dict) -> dict: | |
| __response=dict({"request_data":data}) | |
| try: | |
| if data: | |
| __response['texto']=__main.obtener_texto(from_url=data.get('url')) | |
| else: | |
| raise __main.exception(status_code = 401, datail=f"Datos mal formados:\n{data}") | |
| except Exception as e: | |
| print(e) | |
| #To-do ->agregar mas información en el error fecha, usuario, reqs | |
| raise __main.exception(status_code = 404, datail=e) | |
| finally: | |
| return __response |