File size: 561 Bytes
a66f4aa | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | from classes import API
from fastapi import FastAPI, HTTPException
app = FastAPI(
title="API Dicionário - Português Brasil",
swagger_ui_parameters={"defaultModelsExpandDepth": -1})
"""
# ================================= #
Created by https://github.com/atrikx/
# ================================= #
"""
@app.get("/{palavra}", tags=["Sinônimos"])
async def sinonimos(palavra: str):
sinonimos = await API().sinonimos(palavra)
if not sinonimos:
raise HTTPException(status_code=400, detail="Palavra inválida")
return sinonimos
|