Созданы stubs
This commit is contained in:
1
stubs/aiohttpx/__init__.pyi
Normal file
1
stubs/aiohttpx/__init__.pyi
Normal file
@ -0,0 +1 @@
|
||||
__version__: str = ...
|
||||
33
stubs/aiohttpx/client.pyi
Normal file
33
stubs/aiohttpx/client.pyi
Normal file
@ -0,0 +1,33 @@
|
||||
from collections.abc import Callable, Mapping
|
||||
from ssl import SSLContext
|
||||
from typing import Any
|
||||
|
||||
from httpx import URL, Limits
|
||||
from httpx import AsyncClient as AsyncHTTPXClient
|
||||
from httpx import _types as t # type: ignore
|
||||
|
||||
class AioHTTPXClient(AsyncHTTPXClient):
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
auth: t.AuthTypes | None = ...,
|
||||
params: t.QueryParamTypes | None = ...,
|
||||
headers: t.HeaderTypes | None = ...,
|
||||
cookies: t.CookieTypes | None = ...,
|
||||
verify: SSLContext | str | bool = ...,
|
||||
cert: t.CertTypes | None = ...,
|
||||
proxy: t.ProxyTypes | None = ...,
|
||||
timeout: t.TimeoutTypes = ...,
|
||||
follow_redirects: bool = ...,
|
||||
limits: Limits = ...,
|
||||
max_redirects: int = ...,
|
||||
event_hooks: Mapping[str, list[Callable[..., Any]]] | None = ...,
|
||||
base_url: URL | str = ...,
|
||||
trust_env: bool = ...,
|
||||
default_encoding: str | Callable[[bytes], str] = ...,
|
||||
redis_url: str | None = ...,
|
||||
key: str | None = ...,
|
||||
limit: int | None = ...,
|
||||
) -> None: ...
|
||||
|
||||
__all__ = ['AioHTTPXClient']
|
||||
6
stubs/aiohttpx/responses/__init__.pyi
Normal file
6
stubs/aiohttpx/responses/__init__.pyi
Normal file
@ -0,0 +1,6 @@
|
||||
from typing import Any
|
||||
|
||||
from httpx import Response as HTTPXResponse
|
||||
|
||||
class Response(HTTPXResponse):
|
||||
def json(self, **kwargs: Any) -> Any: ...
|
||||
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