documentation fixes

This commit is contained in:
Ruben van Staveren 2023-12-12 14:49:53 +01:00
parent 734ac03c65
commit 949e8582bc
Signed by: ruben
GPG Key ID: 886F6BECD477A93F

View File

@ -14,6 +14,9 @@ GEOLITE2_ASN_DB = '/usr/local/share/GeoIP/GeoLite2-ASN.mmdb'
GEOLITE2_CITY_DB = '/usr/local/share/GeoIP/GeoLite2-City.mmdb'
class IPAddressParam(BaseModel):
'''
Payload entry as used in POST
'''
ip: Union[IPv6Address,IPv4Address]
class Locality(BaseModel):
@ -39,6 +42,9 @@ class GeoLocation(BaseModel):
async def root_post(ipaddresses: Annotated[list[IPAddressParam],
Body(title="The IPAddresses to geolocate")]
) -> list[GeoLocation]:
'''
Return GeoLocation item(s) for a list of IPAddressParam objects
'''
geolocations = []
with (geoip2.database.Reader(GEOLITE2_ASN_DB) as reader_asn,
geoip2.database.Reader(GEOLITE2_CITY_DB) as reader_city):