This commit is contained in:
Waylon Walker 2023-06-27 16:19:32 -05:00
parent 3490305e39
commit d747299c95
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4
8 changed files with 64 additions and 49 deletions

View file

@ -1,13 +1,11 @@
from typing import Dict, Optional
from typing import Dict
import httpx
from pydantic import BaseModel
from sqlmodel import Field, SQLModel
from learn_sql_model.config import config
from learn_sql_model.optional import optional
from learn_sql_model.models.pet import Pet
class HeroBase(SQLModel, table=False):
@ -75,7 +73,7 @@ class HeroUpdate(HeroBase):
def update(self) -> Hero:
r = httpx.patch(
f"{config.api_client.url}/hero/",
json=self.dict(),
json=self.dict(exclude_none=True),
)
if r.status_code != 200:
raise RuntimeError(f"{r.status_code}:\n {r.text}")