|
|
|
|
@ -1,4 +1,6 @@
|
|
|
|
|
from fastapi import FastAPI
|
|
|
|
|
from fastapi.exception_handlers import request_validation_exception_handler
|
|
|
|
|
from fastapi.exceptions import RequestValidationError
|
|
|
|
|
from pydantic import BaseModel, model_validator
|
|
|
|
|
from typing import Any, Dict
|
|
|
|
|
|
|
|
|
|
@ -9,8 +11,8 @@ import subprocess
|
|
|
|
|
class Sms(BaseModel):
|
|
|
|
|
from_: str
|
|
|
|
|
text: str
|
|
|
|
|
sentStamp: str
|
|
|
|
|
receivedStamp: str
|
|
|
|
|
sentStamp: int
|
|
|
|
|
receivedStamp: int
|
|
|
|
|
sim: str
|
|
|
|
|
|
|
|
|
|
@model_validator(mode="before")
|
|
|
|
|
@ -22,6 +24,11 @@ class Sms(BaseModel):
|
|
|
|
|
|
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
|
|
|
|
@app.exception_handler(RequestValidationError)
|
|
|
|
|
async def validation_exception_handler(request, exc):
|
|
|
|
|
print(f"Invalid data received: {exc}")
|
|
|
|
|
return await request_validation_exception_handler(request, exc)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.get("/")
|
|
|
|
|
async def root():
|
|
|
|
|
|