Add APIModel

This commit is contained in:
洛水居室 2023-05-01 19:17:44 +08:00
parent 90ee5725e0
commit 73410f136e
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

16
simnet/models/base.py Normal file
View File

@ -0,0 +1,16 @@
from pydantic import BaseModel
try:
import ujson as jsonlib
except ImportError:
import json as jsonlib
class APIModel(BaseModel):
"""A Pydantic BaseModel class used for modeling JSON data returned by an API."""
class Config:
"""A nested class defining configuration options for the APIModel."""
json_dumps = jsonlib.dumps
json_loads = jsonlib.loads