sotkalib 0.0.5.post3__py3-none-any.whl → 0.0.5.post4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sotkalib/http/__init__.py +0 -3
- sotkalib/http/client_session.py +6 -22
- sotkalib/redis/client.py +2 -1
- {sotkalib-0.0.5.post3.dist-info → sotkalib-0.0.5.post4.dist-info}/METADATA +1 -1
- {sotkalib-0.0.5.post3.dist-info → sotkalib-0.0.5.post4.dist-info}/RECORD +6 -6
- {sotkalib-0.0.5.post3.dist-info → sotkalib-0.0.5.post4.dist-info}/WHEEL +0 -0
sotkalib/http/__init__.py
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
from .client_session import (
|
|
2
2
|
ClientSettings,
|
|
3
|
-
# Exceptions
|
|
4
3
|
CriticalStatusError,
|
|
5
4
|
ExceptionSettings,
|
|
6
|
-
Handler,
|
|
7
5
|
HTTPSession,
|
|
8
6
|
Middleware,
|
|
9
7
|
Next,
|
|
@@ -19,7 +17,6 @@ __all__ = (
|
|
|
19
17
|
"ExceptionSettings",
|
|
20
18
|
"StatusSettings",
|
|
21
19
|
"ClientSettings",
|
|
22
|
-
"Handler",
|
|
23
20
|
"Middleware",
|
|
24
21
|
"Next",
|
|
25
22
|
# Exceptions
|
sotkalib/http/client_session.py
CHANGED
|
@@ -119,9 +119,11 @@ async def default_stat_arg_func(ctx: RequestContext) -> tuple[Sequence[Any], Non
|
|
|
119
119
|
|
|
120
120
|
|
|
121
121
|
def default_exc_arg_func(ctx: RequestContext) -> tuple[Sequence[Any], None]:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
return (
|
|
123
|
+
(
|
|
124
|
+
f"exception {type(ctx.last_error)}: ({ctx.last_error=}) attempt={ctx.attempt}; url={ctx.url} method={ctx.method}"
|
|
125
|
+
),
|
|
126
|
+
), None
|
|
125
127
|
|
|
126
128
|
|
|
127
129
|
class StatusSettings(BaseModel):
|
|
@@ -215,7 +217,7 @@ class HTTPSession[R = aiohttp.ClientResponse | None]:
|
|
|
215
217
|
self._middlewares = _middlewares or []
|
|
216
218
|
self._logger = get_logger("http.client_session")
|
|
217
219
|
|
|
218
|
-
def use[NewR](self, middleware: Middleware[R, NewR]) -> HTTPSession[NewR]:
|
|
220
|
+
def use[NewR](self, middleware: Middleware[R, NewR]) -> "HTTPSession[NewR]":
|
|
219
221
|
return HTTPSession[NewR](
|
|
220
222
|
config=self.config,
|
|
221
223
|
_middlewares=[*self._middlewares, middleware],
|
|
@@ -424,21 +426,3 @@ class HTTPSession[R = aiohttp.ClientResponse | None]:
|
|
|
424
426
|
|
|
425
427
|
def merge_tuples[T](t1: tuple[T, ...], t2: tuple[T, ...]) -> tuple[T, ...]:
|
|
426
428
|
return t1 + t2
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
# ============================================================================
|
|
430
|
-
# Legacy compatibility aliases
|
|
431
|
-
# ============================================================================
|
|
432
|
-
|
|
433
|
-
# Old Handler protocol - kept for backwards compatibility but deprecated
|
|
434
|
-
from typing import Protocol
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
class Handler[**P, T](Protocol):
|
|
438
|
-
"""
|
|
439
|
-
DEPRECATED: Use Middleware type instead.
|
|
440
|
-
|
|
441
|
-
Old handler protocol for backwards compatibility.
|
|
442
|
-
"""
|
|
443
|
-
|
|
444
|
-
async def __call__(self, *args: P.args, **kwargs: P.kwargs) -> T: ...
|
sotkalib/redis/client.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
from contextlib import AbstractAsyncContextManager
|
|
3
|
+
from typing import Self
|
|
3
4
|
|
|
4
5
|
from pydantic import BaseModel, Field
|
|
5
6
|
from redis.asyncio import ConnectionPool, Redis
|
|
@@ -29,7 +30,7 @@ class RedisPool(AbstractAsyncContextManager):
|
|
|
29
30
|
self._usage_counter = 0
|
|
30
31
|
self._usage_lock = asyncio.Lock()
|
|
31
32
|
|
|
32
|
-
async def __aenter__(self:
|
|
33
|
+
async def __aenter__(self: Self) -> Redis:
|
|
33
34
|
try:
|
|
34
35
|
return Redis(connection_pool=self._pool)
|
|
35
36
|
except Exception:
|
|
@@ -10,16 +10,16 @@ sotkalib/exceptions/api/exc.py,sha256=gqx4GrHXUvKcR7tEmJpRqPbDWOT2AgKoyck8-FovQC
|
|
|
10
10
|
sotkalib/exceptions/handlers/__init__.py,sha256=Pz1akT2x3SaRsPezNPYnCoTcejxy4n4_cO4cXRJUBIk,179
|
|
11
11
|
sotkalib/exceptions/handlers/args_incl_error.py,sha256=rYiBximsXVw1YDUBbdsqeqsfTWxshyX4EdISXWYkPDE,533
|
|
12
12
|
sotkalib/exceptions/handlers/core.py,sha256=5fhusoxBhUz59TaVWobplBvD-sbkZKBnmmu-fcSyRk4,836
|
|
13
|
-
sotkalib/http/__init__.py,sha256=
|
|
14
|
-
sotkalib/http/client_session.py,sha256=
|
|
13
|
+
sotkalib/http/__init__.py,sha256=xi4qStyHRgLufX_3ziSL5_-hDlbVLzA1Eg8JtjfHMz8,421
|
|
14
|
+
sotkalib/http/client_session.py,sha256=TDlKZ-xWOJ6kHX28f-vW1jj1mezI2D4JTqsEpymfNPY,12429
|
|
15
15
|
sotkalib/log/__init__.py,sha256=xrBx--c8QU5xkb3_n61LuqF8ySUaxlQkHCxHyH_D8aE,58
|
|
16
16
|
sotkalib/log/factory.py,sha256=BM8gTHoITCsS4b9JNGST4czpDql5mVTIPsESutO2OGQ,214
|
|
17
17
|
sotkalib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
18
|
sotkalib/redis/__init__.py,sha256=-0ZXD-cC-Xi6RmAvnrAgU-8Z6g4l88XmXf3kvIgBD9k,154
|
|
19
|
-
sotkalib/redis/client.py,sha256=
|
|
19
|
+
sotkalib/redis/client.py,sha256=W13VOlPtEb9HuDomQ9Uz7Fh3iq94mBWX6EXOeRRYtiQ,1137
|
|
20
20
|
sotkalib/redis/lock.py,sha256=nEZjIyXmgq3vH-Urs8qXC_N8lmXNho00SaTZ7wJIEIo,2528
|
|
21
21
|
sotkalib/sqla/__init__.py,sha256=n-I_hoRS-N7XN02yYCTtw6Dh4BBSQRmolS19tEB2KMM,87
|
|
22
22
|
sotkalib/sqla/db.py,sha256=6ZckKQ8kmRlYrwCAzKidc_JNPwqp38tSGEy3XMGnv08,3376
|
|
23
|
-
sotkalib-0.0.5.
|
|
24
|
-
sotkalib-0.0.5.
|
|
25
|
-
sotkalib-0.0.5.
|
|
23
|
+
sotkalib-0.0.5.post4.dist-info/WHEEL,sha256=5DEXXimM34_d4Gx1AuF9ysMr1_maoEtGKjaILM3s4w4,80
|
|
24
|
+
sotkalib-0.0.5.post4.dist-info/METADATA,sha256=XakN-v3wD1jQR_ySKvBFhAdL-SqKCvDHHcBpfnj0ppo,392
|
|
25
|
+
sotkalib-0.0.5.post4.dist-info/RECORD,,
|
|
File without changes
|