File size: 626 Bytes
2851db2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from api.core.app import Demos
__main = Demos()
api = __main.api()
@api.post("/obtener_texto", status_code=201)
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