documentation fixes
This commit is contained in:
parent
734ac03c65
commit
949e8582bc
@ -14,6 +14,9 @@ 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'
|
||||||
|
|
||||||
class IPAddressParam(BaseModel):
|
class IPAddressParam(BaseModel):
|
||||||
|
'''
|
||||||
|
Payload entry as used in POST
|
||||||
|
'''
|
||||||
ip: Union[IPv6Address,IPv4Address]
|
ip: Union[IPv6Address,IPv4Address]
|
||||||
|
|
||||||
class Locality(BaseModel):
|
class Locality(BaseModel):
|
||||||
@ -39,6 +42,9 @@ class GeoLocation(BaseModel):
|
|||||||
async def root_post(ipaddresses: Annotated[list[IPAddressParam],
|
async def root_post(ipaddresses: Annotated[list[IPAddressParam],
|
||||||
Body(title="The IPAddresses to geolocate")]
|
Body(title="The IPAddresses to geolocate")]
|
||||||
) -> list[GeoLocation]:
|
) -> list[GeoLocation]:
|
||||||
|
'''
|
||||||
|
Return GeoLocation item(s) for a list of IPAddressParam objects
|
||||||
|
'''
|
||||||
geolocations = []
|
geolocations = []
|
||||||
with (geoip2.database.Reader(GEOLITE2_ASN_DB) as reader_asn,
|
with (geoip2.database.Reader(GEOLITE2_ASN_DB) as reader_asn,
|
||||||
geoip2.database.Reader(GEOLITE2_CITY_DB) as reader_city):
|
geoip2.database.Reader(GEOLITE2_CITY_DB) as reader_city):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user