FastAPI POST - ошибка 422 подробно'': ( ( loc'':(body file msg'':поле обязательно'', type'': value_error отсутствует))) Python

Программы на Python
Anonymous
FastAPI POST - ошибка 422 подробно'': ( ( loc'':(body file msg'':поле обязательно'', type'': value_error отсутствует)))

Сообщение Anonymous »

Я хочу прочитать на сервере этот файл xlsx. Когда я использую swagger, я получаю это, но когда я тестирую внешний интерфейс, я получаю ошибку 422 - devtools/Network Detail'': ( ( loc'':(body file msg'':поле требуется'', введите'': value_error отсутствует))).
router = APIRouter()

@router.post('/')
async def upload_file(file: Uploadfile = File(...)):

try:
arquivo = await file.read()
df_cambio = pd.read_excel(arquivo)
cambio_dict = df_cambio.to_dict('index')

print(cambio_dict)
return{"file_name": file.filename}

except Exception as e:
exception_handler(e)

реагировать ->
export defaut function Dropzone() {
const [create, {isLoading}] = usePost();

const handleSubmit = (res) => {
create('cambios', { data:res.file }})
};
if (isLoading) { return ;}

return (




Подробнее здесь: https://stackoverflow.com/questions/733 ... d-required

Вернуться в «Python»