Созданы stubs
This commit is contained in:
0
stubs/aiohttpx/transports/__init__.pyi
Normal file
0
stubs/aiohttpx/transports/__init__.pyi
Normal file
31
stubs/aiohttpx/transports/aio.pyi
Normal file
31
stubs/aiohttpx/transports/aio.pyi
Normal file
@ -0,0 +1,31 @@
|
||||
from types import TracebackType
|
||||
from typing import Any, Self
|
||||
|
||||
import aiohttp
|
||||
import httpx
|
||||
|
||||
from aiohttpx.responses import Response
|
||||
|
||||
EXCEPTIONS = ...
|
||||
|
||||
class AiohttpTransport(httpx.AsyncBaseTransport):
|
||||
def __init__(
|
||||
self, session: aiohttp.ClientSession | None = ...
|
||||
) -> None: ...
|
||||
def map_aiohttp_exception(
|
||||
self, exc: Exception
|
||||
) -> httpx.TimeoutException | httpx.HTTPError: ...
|
||||
async def __aenter__(self) -> Self: ...
|
||||
async def __aexit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None = ...,
|
||||
exc_value: BaseException | None = ...,
|
||||
traceback: TracebackType | None = ...,
|
||||
) -> None: ...
|
||||
async def aclose(self) -> None: ...
|
||||
async def handle_async_request(
|
||||
self, request: httpx.Request
|
||||
) -> Response: ...
|
||||
async def make_request(
|
||||
self, method: str, url: str, headers: dict[str, Any], data: bytes
|
||||
) -> Response: ...
|
||||
26
stubs/aiohttpx/transports/cache.pyi
Normal file
26
stubs/aiohttpx/transports/cache.pyi
Normal file
@ -0,0 +1,26 @@
|
||||
from httpx import Request
|
||||
from httpx import Response as HTTPXResponse
|
||||
from httpx import _models as m # type: ignore
|
||||
|
||||
from aiohttpx.responses import Response
|
||||
from aiohttpx.transports.rate_limiter import AsyncRateLimit, Redis
|
||||
|
||||
def generate_cache_key(request: Request) -> str: ...
|
||||
def cache_response(
|
||||
client: Redis[bytes],
|
||||
cache_key: str,
|
||||
request: Request,
|
||||
response: Response | HTTPXResponse,
|
||||
) -> None: ...
|
||||
def get_ttl_from_headers(headers: m.Headers) -> int | None: ...
|
||||
def get_cached_response(
|
||||
client: Redis[bytes], cache_key: str
|
||||
) -> Response | None: ...
|
||||
def serialize_response(response: Response | HTTPXResponse) -> bytes: ...
|
||||
def deserialize_response(serialized_response: bytes) -> Response: ...
|
||||
|
||||
class AsyncCacheTransport(AsyncRateLimit):
|
||||
def __init__(
|
||||
self, redis_url: str | None, key: str | None, limit: int | None
|
||||
) -> None: ...
|
||||
async def handle_async_request(self, request: Request) -> Response: ...
|
||||
12
stubs/aiohttpx/transports/rate_limiter.pyi
Normal file
12
stubs/aiohttpx/transports/rate_limiter.pyi
Normal file
@ -0,0 +1,12 @@
|
||||
from httpx import Request
|
||||
from redis import Redis
|
||||
|
||||
from aiohttpx.responses import Response
|
||||
from aiohttpx.transports.aio import AiohttpTransport
|
||||
|
||||
class AsyncRateLimit(AiohttpTransport):
|
||||
def __init__(
|
||||
self, redis: Redis[bytes] | None, key: str | None, limit: int | None
|
||||
) -> None: ...
|
||||
async def request_is_limited(self) -> bool: ...
|
||||
async def handle_async_request(self, request: Request) -> Response: ...
|
||||
Reference in New Issue
Block a user