Добавлена функция для чистки параметров запроса
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "aiohttpx"
|
name = "aiohttpx"
|
||||||
version = "1.0.0"
|
version = "1.1.0"
|
||||||
description = "Custom HTTPX client with aiohttp transport, rate limiter and caching"
|
description = "Custom HTTPX client with aiohttp transport, rate limiter and caching"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = [
|
authors = [
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
__version__: str = '1.0.0'
|
__version__: str = '1.1.0'
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
from collections.abc import Callable, Mapping
|
from collections.abc import Callable, Mapping
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from ssl import SSLContext
|
from ssl import SSLContext
|
||||||
from typing import Any
|
from typing import Any, TypeVar
|
||||||
|
|
||||||
from httpx import URL, Limits
|
from httpx import URL, Limits
|
||||||
from httpx import AsyncClient as AsyncHTTPXClient
|
from httpx import AsyncClient as AsyncHTTPXClient
|
||||||
@ -10,6 +10,8 @@ from httpx import _types as t # type: ignore
|
|||||||
|
|
||||||
from aiohttpx.transports.cache import AsyncCacheTransport
|
from aiohttpx.transports.cache import AsyncCacheTransport
|
||||||
|
|
||||||
|
K = TypeVar('K')
|
||||||
|
|
||||||
|
|
||||||
class AioHTTPXClient(AsyncHTTPXClient):
|
class AioHTTPXClient(AsyncHTTPXClient):
|
||||||
def __init__(
|
def __init__(
|
||||||
@ -59,5 +61,8 @@ class AioHTTPXClient(AsyncHTTPXClient):
|
|||||||
|
|
||||||
self.logger = getLogger(logger)
|
self.logger = getLogger(logger)
|
||||||
|
|
||||||
|
def clean_dict[K, V](self, params: dict[K, Any | None]):
|
||||||
|
return {k: v for k, v in params.items() if v is not None}
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['AioHTTPXClient']
|
__all__ = ['AioHTTPXClient']
|
||||||
|
|||||||
Reference in New Issue
Block a user