Fix geo_re_resolve async mocks and mark tasks complete
This commit is contained in:
@@ -30,7 +30,8 @@ Usage::
|
||||
# single lookup
|
||||
info = await geo_service.lookup("1.2.3.4", session)
|
||||
if info:
|
||||
print(info.country_code) # "DE"
|
||||
# info.country_code == "DE"
|
||||
... # use the GeoInfo object in your application
|
||||
|
||||
# bulk lookup (more efficient for large sets)
|
||||
geo_map = await geo_service.lookup_batch(["1.2.3.4", "5.6.7.8"], session)
|
||||
@@ -42,7 +43,7 @@ import asyncio
|
||||
import time
|
||||
from collections.abc import Awaitable, Callable
|
||||
from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING, TypeAlias
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import aiohttp
|
||||
import structlog
|
||||
@@ -119,7 +120,7 @@ class GeoInfo:
|
||||
"""Organisation name associated with the IP, e.g. ``"Deutsche Telekom"``."""
|
||||
|
||||
|
||||
GeoEnricher: TypeAlias = Callable[[str], Awaitable[GeoInfo | None]]
|
||||
type GeoEnricher = Callable[[str], Awaitable[GeoInfo | None]]
|
||||
"""Async callable used to enrich IPs with :class:`~app.services.geo_service.GeoInfo`.
|
||||
|
||||
This is a shared type alias used by services that optionally accept a geo
|
||||
|
||||
Reference in New Issue
Block a user