This decorator messes up pydantics BaseModel

This commit is contained in:
Ruben van Staveren 2023-12-12 10:50:16 +01:00
parent 4c4203a679
commit 49e16b106f
Signed by: ruben
GPG Key ID: 886F6BECD477A93F

View File

@ -1,7 +1,6 @@
''' '''
Simple Geolocation with FastAPI Simple Geolocation with FastAPI
''' '''
import dataclasses
from ipaddress import IPv4Address, IPv4Network, IPv6Address, IPv6Network from ipaddress import IPv4Address, IPv4Network, IPv6Address, IPv6Network
from typing import Annotated, Optional, Union from typing import Annotated, Optional, Union
@ -14,7 +13,6 @@ app = FastAPI()
GEOLITE2_ASN_DB = '/usr/local/share/GeoIP/GeoLite2-ASN.mmdb' GEOLITE2_ASN_DB = '/usr/local/share/GeoIP/GeoLite2-ASN.mmdb'
GEOLITE2_CITY_DB = '/usr/local/share/GeoIP/GeoLite2-City.mmdb' GEOLITE2_CITY_DB = '/usr/local/share/GeoIP/GeoLite2-City.mmdb'
@dataclasses.dataclass
class Locality(BaseModel): class Locality(BaseModel):
''' '''
Locality data Locality data
@ -24,7 +22,6 @@ class Locality(BaseModel):
continent: Optional[str] continent: Optional[str]
is_eu: bool is_eu: bool
@dataclasses.dataclass
class GeoLocation(BaseModel): class GeoLocation(BaseModel):
''' '''
Geolocation data model Geolocation data model