From 33f25c799c58b01ab96662f21fc8bd0460a814e6 Mon Sep 17 00:00:00 2001 From: Miwory Date: Mon, 27 Oct 2025 22:05:46 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=B5=D1=80=D1=81=D0=B8=D1=8F=201.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 +++++++ pyproject.toml | 2 +- src/aiohttpx/__init__.py | 2 +- src/aiohttpx/client.py | 3 ++- src/aiohttpx/status.py | 56 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 src/aiohttpx/status.py diff --git a/README.md b/README.md index e69de29..89145ba 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,9 @@ +# aiohttpx + +aiohttpx is a HTTP client built on top of the [httpx](https://github.com/encode/httpx) and [aiohttp](https://github.com/aio-libs/aiohttp) libraries. + +## Features + +* Fully asynchronous using aiohttp as the transport +* Supports caching using Redis as the backend +* Supports rate limiting using Redis as the backend diff --git a/pyproject.toml b/pyproject.toml index 48ca9d4..7fbc9b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "aiohttpx" -version = "0.3.0" +version = "1.0.0" description = "Custom HTTPX client with aiohttp transport, rate limiter and caching" readme = "README.md" authors = [ diff --git a/src/aiohttpx/__init__.py b/src/aiohttpx/__init__.py index 29a7547..7f98504 100644 --- a/src/aiohttpx/__init__.py +++ b/src/aiohttpx/__init__.py @@ -1 +1 @@ -__version__: str = '0.3.0' +__version__: str = '1.0.0' diff --git a/src/aiohttpx/client.py b/src/aiohttpx/client.py index ea7ab9b..9ee722f 100644 --- a/src/aiohttpx/client.py +++ b/src/aiohttpx/client.py @@ -33,6 +33,7 @@ class AioHTTPXClient(AsyncHTTPXClient): redis_url: str | None = None, key: str | None = None, limit: int | None = None, + logger: str | None = __name__ ) -> None: super().__init__( auth=auth, @@ -56,7 +57,7 @@ class AioHTTPXClient(AsyncHTTPXClient): default_encoding=default_encoding, ) - self.logger = getLogger(__name__) + self.logger = getLogger(logger) __all__ = ['AioHTTPXClient'] diff --git a/src/aiohttpx/status.py b/src/aiohttpx/status.py new file mode 100644 index 0000000..6ac26aa --- /dev/null +++ b/src/aiohttpx/status.py @@ -0,0 +1,56 @@ +CONTINUE = 100 +SWITCHING_PROTOCOLS = 101 +OK = 200 +CREATED = 201 +ACCEPTED = 202 +NON_AUTHORITATIVE_INFORMATION = 203 +NO_CONTENT = 204 +RESET_CONTENT = 205 +PARTIAL_CONTENT = 206 +MULTIPLE_CHOICES = 300 +MOVED_PERMANENTLY = 301 +FOUND = 302 +SEE_OTHER = 303 +NOT_MODIFIED = 304 +USE_PROXY = 305 +SWITCH_PROXY = 306 +TEMPORARY_REDIRECT = 307 +PERMANENT_REDIRECT = 308 +BAD_REQUEST = 400 +UNAUTHORIZED = 401 +PAYMENT_REQUIRED = 402 +FORBIDDEN = 403 +NOT_FOUND = 404 +METHOD_NOT_ALLOWED = 405 +NOT_ACCEPTABLE = 406 +PROXY_AUTHENTICATION_REQUIRED = 407 +REQUEST_TIMEOUT = 408 +CONFLICT = 409 +GONE = 410 +LENGTH_REQUIRED = 411 +PRECONDITION_FAILED = 412 +REQUEST_ENTITY_TOO_LARGE = 413 +REQUEST_URI_TOO_LONG = 414 +UNSUPPORTED_MEDIA_TYPE = 415 +REQUESTED_RANGE_NOT_SATISFIABLE = 416 +EXPECTATION_FAILED = 417 +IM_A_TEAPOT = 418 +MISDIRECTED_REQUEST = 422 +UNPROCESSABLE_ENTITY = 422 +LOCKED = 423 +FAILED_DEPENDENCY = 424 +UPGRADE_REQUIRED = 426 +PRECONDITION_REQUIRED = 428 +TOO_MANY_REQUESTS = 429 +REQUEST_HEADER_FIELDS_TOO_LARGE = 431 +INTERNAL_SERVER_ERROR = 500 +NOT_IMPLEMENTED = 501 +BAD_GATEWAY = 502 +SERVICE_UNAVAILABLE = 503 +GATEWAY_TIMEOUT = 504 +HTTP_VERSION_NOT_SUPPORTED = 505 +VARIANT_ALSO_NEGOTIATES = 506 +INSUFFICIENT_STORAGE = 507 +LOOP_DETECTED = 508 +NOT_EXTENDED = 510 +NETWORK_AUTHENTICATION_REQUIRED = 511