diff --git a/ipinfo/cache/default.py b/ipinfo/cache/default.py index 0e07c66..d5b502c 100644 --- a/ipinfo/cache/default.py +++ b/ipinfo/cache/default.py @@ -2,16 +2,14 @@ A default cache implementation that uses `cachetools` for an in-memory LRU cache. """ -import cachetools - from .interface import CacheInterface - +from cachetools import TTLCache class DefaultCache(CacheInterface): """Default, in-memory cache.""" def __init__(self, **cache_options): - self.cache = cachetools.TTLCache(**cache_options) + self.cache = TTLCache(**cache_options) def __contains__(self, key): return self.cache.__contains__(key) diff --git a/ipinfo/handler_async.py b/ipinfo/handler_async.py index 4c5fd47..853d556 100644 --- a/ipinfo/handler_async.py +++ b/ipinfo/handler_async.py @@ -150,7 +150,7 @@ async def getDetails(self, ip_address=None, timeout=None): if content_type == "application/json": error_response = await resp.json() else: - error_response = {"error": resp.text()} + error_response = {"error": await resp.text()} raise APIError(error_code, error_response) details = await resp.json() @@ -208,7 +208,7 @@ async def getResproxy(self, ip_address, timeout=None): if content_type == "application/json": error_response = await resp.json() else: - error_response = {"error": resp.text()} + error_response = {"error": await resp.text()} raise APIError(error_code, error_response) details = await resp.json() diff --git a/ipinfo/handler_core_async.py b/ipinfo/handler_core_async.py index 9b77943..c00413e 100644 --- a/ipinfo/handler_core_async.py +++ b/ipinfo/handler_core_async.py @@ -153,7 +153,7 @@ async def getDetails(self, ip_address=None, timeout=None): if content_type == "application/json": error_response = await resp.json() else: - error_response = {"error": resp.text()} + error_response = {"error": await resp.text()} raise APIError(error_code, error_response) details = await resp.json() diff --git a/ipinfo/handler_lite_async.py b/ipinfo/handler_lite_async.py index 106b8d2..37a039e 100644 --- a/ipinfo/handler_lite_async.py +++ b/ipinfo/handler_lite_async.py @@ -141,7 +141,7 @@ async def getDetails(self, ip_address=None, timeout=None): if content_type == "application/json": error_response = await resp.json() else: - error_response = {"error": resp.text()} + error_response = {"error": await resp.text()} raise APIError(error_code, error_response) details = await resp.json() diff --git a/ipinfo/handler_plus_async.py b/ipinfo/handler_plus_async.py index 34adf98..2fee5a6 100644 --- a/ipinfo/handler_plus_async.py +++ b/ipinfo/handler_plus_async.py @@ -153,7 +153,7 @@ async def getDetails(self, ip_address=None, timeout=None): if content_type == "application/json": error_response = await resp.json() else: - error_response = {"error": resp.text()} + error_response = {"error": await resp.text()} raise APIError(error_code, error_response) details = await resp.json() diff --git a/pyproject.toml b/pyproject.toml index 84cfd18..49f5aab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,9 +9,9 @@ authors = [ license = { text = "Apache License 2.0" } requires-python = ">=3.10" dependencies = [ - "requests>=2.18.4", - "cachetools==4.2.0", - "aiohttp>=3.12.14,<=4", + "requests>=2.18.4,<3", + "cachetools>=4.2,<8", + "aiohttp>=3,<4", ] [project.urls] diff --git a/uv.lock b/uv.lock index 605335e..d5fb6cc 100644 --- a/uv.lock +++ b/uv.lock @@ -489,9 +489,9 @@ dev = [ [package.metadata] requires-dist = [ - { name = "aiohttp", specifier = ">=3.12.14,<=4" }, - { name = "cachetools", specifier = "==4.2.0" }, - { name = "requests", specifier = ">=2.18.4" }, + { name = "aiohttp", specifier = ">=3,<4" }, + { name = "cachetools", specifier = ">=4.2,<8" }, + { name = "requests", specifier = ">=2.18.4,<3" }, ] [package.metadata.requires-dev]