python3-commons 0.14.10__tar.gz → 0.14.11__tar.gz
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.
- {python3_commons-0.14.10 → python3_commons-0.14.11}/.pre-commit-config.yaml +2 -2
- {python3_commons-0.14.10 → python3_commons-0.14.11}/PKG-INFO +2 -2
- {python3_commons-0.14.10 → python3_commons-0.14.11}/pyproject.toml +1 -1
- python3_commons-0.14.11/src/python3_commons/audit.py +65 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/conf.py +2 -1
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons.egg-info/PKG-INFO +2 -2
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons.egg-info/requires.txt +1 -1
- {python3_commons-0.14.10 → python3_commons-0.14.11}/uv.lock +33 -71
- python3_commons-0.14.10/src/python3_commons/audit.py +0 -188
- {python3_commons-0.14.10 → python3_commons-0.14.11}/.coveragerc +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/.devcontainer/Dockerfile +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/.devcontainer/devcontainer.json +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/.devcontainer/docker-compose.yml +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/.env_template +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/.github/workflows/checks.yml +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/.github/workflows/python-publish.yaml +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/.github/workflows/release-on-tag-push.yml +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/.gitignore +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/.python-version +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/AUTHORS.rst +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/CHANGELOG.rst +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/LICENSE +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/README.md +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/README.rst +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/docs/Makefile +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/docs/_static/.gitignore +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/docs/authors.rst +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/docs/changelog.rst +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/docs/conf.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/docs/index.rst +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/docs/license.rst +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/setup.cfg +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/__init__.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/api_client.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/auth.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/cache.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/db/__init__.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/db/helpers.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/db/models/__init__.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/db/models/auth.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/db/models/common.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/exceptions.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/fs.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/generators.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/helpers.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/log/__init__.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/log/filters.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/log/formatters.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/object_storage.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/serializers/__init__.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/serializers/common.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/serializers/json.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/serializers/msgpack.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/serializers/msgspec.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons.egg-info/SOURCES.txt +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons.egg-info/dependency_links.txt +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons.egg-info/top_level.txt +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/tests/__init__.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/tests/integration/__init__.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/tests/integration/test_cache.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/tests/unit/__init__.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/tests/unit/conftest.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/tests/unit/test_audit.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/tests/unit/test_helpers.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/tests/unit/test_msgpack.py +0 -0
- {python3_commons-0.14.10 → python3_commons-0.14.11}/tests/unit/test_msgspec.py +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
repos:
|
|
2
2
|
- repo: https://github.com/astral-sh/uv-pre-commit
|
|
3
|
-
rev: 0.9.
|
|
3
|
+
rev: 0.9.13
|
|
4
4
|
hooks:
|
|
5
5
|
- id: uv-lock
|
|
6
6
|
# - id: uv-export
|
|
7
7
|
|
|
8
8
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
9
|
-
rev: v0.14.
|
|
9
|
+
rev: v0.14.7
|
|
10
10
|
hooks:
|
|
11
11
|
# Run the linter.
|
|
12
12
|
- id: ruff-check
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python3-commons
|
|
3
|
-
Version: 0.14.
|
|
3
|
+
Version: 0.14.11
|
|
4
4
|
Summary: Re-usable Python3 code
|
|
5
5
|
Author-email: Oleg Korsak <kamikaze.is.waiting.you@gmail.com>
|
|
6
6
|
License-Expression: GPL-3.0
|
|
@@ -12,7 +12,7 @@ Requires-Python: <3.15.0,>=3.13.9
|
|
|
12
12
|
Description-Content-Type: text/x-rst
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
License-File: AUTHORS.rst
|
|
15
|
-
Requires-Dist: aiobotocore~=2.
|
|
15
|
+
Requires-Dist: aiobotocore~=2.26.0
|
|
16
16
|
Requires-Dist: aiohttp[speedups]<3.15.0,>=3.12.0
|
|
17
17
|
Requires-Dist: asyncpg~=0.31.0
|
|
18
18
|
Requires-Dist: lxml~=6.0.2
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import io
|
|
3
|
+
import logging
|
|
4
|
+
from datetime import UTC, datetime
|
|
5
|
+
from typing import TYPE_CHECKING
|
|
6
|
+
from uuid import uuid4
|
|
7
|
+
|
|
8
|
+
from lxml import etree
|
|
9
|
+
from zeep.plugins import Plugin
|
|
10
|
+
|
|
11
|
+
from python3_commons import object_storage
|
|
12
|
+
from python3_commons.conf import S3Settings, s3_settings
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from zeep.wsdl.definitions import AbstractOperation
|
|
16
|
+
|
|
17
|
+
logger = logging.getLogger(__name__)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
async def write_audit_data(settings: S3Settings, key: str, data: bytes) -> None:
|
|
21
|
+
if settings.aws_secret_access_key:
|
|
22
|
+
try:
|
|
23
|
+
absolute_path = object_storage.get_absolute_path(f'audit/{key}')
|
|
24
|
+
|
|
25
|
+
await object_storage.put_object(settings.s3_bucket, absolute_path, io.BytesIO(data), len(data))
|
|
26
|
+
except Exception:
|
|
27
|
+
logger.exception('Failed storing object in storage.')
|
|
28
|
+
else:
|
|
29
|
+
logger.debug(f'Stored object in storage: {key}')
|
|
30
|
+
else:
|
|
31
|
+
logger.debug(f'S3 is not configured, not storing object in storage: {key}')
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class ZeepAuditPlugin(Plugin):
|
|
35
|
+
def __init__(self, audit_name: str = 'zeep') -> None:
|
|
36
|
+
super().__init__()
|
|
37
|
+
self.audit_name = audit_name
|
|
38
|
+
|
|
39
|
+
def store_audit_in_s3(self, envelope, operation: AbstractOperation, direction: str) -> None:
|
|
40
|
+
xml = etree.tostring(envelope, encoding='UTF-8', pretty_print=True)
|
|
41
|
+
now = datetime.now(tz=UTC)
|
|
42
|
+
date_path = now.strftime('%Y/%m/%d')
|
|
43
|
+
timestamp = now.strftime('%H%M%S')
|
|
44
|
+
path = f'{date_path}/{self.audit_name}/{operation.name}/{timestamp}_{str(uuid4())[-12:]}_{direction}.xml'
|
|
45
|
+
coro = write_audit_data(s3_settings, path, xml)
|
|
46
|
+
|
|
47
|
+
try:
|
|
48
|
+
loop = asyncio.get_running_loop()
|
|
49
|
+
except RuntimeError:
|
|
50
|
+
loop = None
|
|
51
|
+
|
|
52
|
+
if loop and loop.is_running():
|
|
53
|
+
loop.create_task(coro)
|
|
54
|
+
else:
|
|
55
|
+
asyncio.run(coro)
|
|
56
|
+
|
|
57
|
+
def ingress(self, envelope, http_headers, operation: AbstractOperation):
|
|
58
|
+
self.store_audit_in_s3(envelope, operation, 'ingress')
|
|
59
|
+
|
|
60
|
+
return envelope, http_headers
|
|
61
|
+
|
|
62
|
+
def egress(self, envelope, http_headers, operation: AbstractOperation, binding_options):
|
|
63
|
+
self.store_audit_in_s3(envelope, operation, 'egress')
|
|
64
|
+
|
|
65
|
+
return envelope, http_headers
|
|
@@ -17,11 +17,12 @@ class OIDCSettings(BaseSettings):
|
|
|
17
17
|
authority_url: HttpUrl | None = None
|
|
18
18
|
client_id: str | None = None
|
|
19
19
|
redirect_uri: str | None = None
|
|
20
|
-
|
|
20
|
+
scope: Sequence[str] = (
|
|
21
21
|
'openid',
|
|
22
22
|
'profile',
|
|
23
23
|
'email',
|
|
24
24
|
)
|
|
25
|
+
audience: Sequence[str] = ()
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
class ValkeySettings(BaseSettings):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python3-commons
|
|
3
|
-
Version: 0.14.
|
|
3
|
+
Version: 0.14.11
|
|
4
4
|
Summary: Re-usable Python3 code
|
|
5
5
|
Author-email: Oleg Korsak <kamikaze.is.waiting.you@gmail.com>
|
|
6
6
|
License-Expression: GPL-3.0
|
|
@@ -12,7 +12,7 @@ Requires-Python: <3.15.0,>=3.13.9
|
|
|
12
12
|
Description-Content-Type: text/x-rst
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
License-File: AUTHORS.rst
|
|
15
|
-
Requires-Dist: aiobotocore~=2.
|
|
15
|
+
Requires-Dist: aiobotocore~=2.26.0
|
|
16
16
|
Requires-Dist: aiohttp[speedups]<3.15.0,>=3.12.0
|
|
17
17
|
Requires-Dist: asyncpg~=0.31.0
|
|
18
18
|
Requires-Dist: lxml~=6.0.2
|
|
@@ -8,7 +8,7 @@ resolution-markers = [
|
|
|
8
8
|
|
|
9
9
|
[[package]]
|
|
10
10
|
name = "aiobotocore"
|
|
11
|
-
version = "2.
|
|
11
|
+
version = "2.26.0"
|
|
12
12
|
source = { registry = "https://pypi.org/simple" }
|
|
13
13
|
dependencies = [
|
|
14
14
|
{ name = "aiohttp" },
|
|
@@ -19,9 +19,9 @@ dependencies = [
|
|
|
19
19
|
{ name = "python-dateutil" },
|
|
20
20
|
{ name = "wrapt" },
|
|
21
21
|
]
|
|
22
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
22
|
+
sdist = { url = "https://files.pythonhosted.org/packages/4d/f8/99fa90d9c25b78292899fd4946fce97b6353838b5ecc139ad8ba1436e70c/aiobotocore-2.26.0.tar.gz", hash = "sha256:50567feaf8dfe2b653570b4491f5bc8c6e7fb9622479d66442462c021db4fadc", size = 122026, upload-time = "2025-11-28T07:54:59.956Z" }
|
|
23
23
|
wheels = [
|
|
24
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
24
|
+
{ url = "https://files.pythonhosted.org/packages/b7/58/3bf0b7d474607dc7fd67dd1365c4e0f392c8177eaf4054e5ddee3ebd53b5/aiobotocore-2.26.0-py3-none-any.whl", hash = "sha256:a793db51c07930513b74ea7a95bd79aaa42f545bdb0f011779646eafa216abec", size = 87333, upload-time = "2025-11-28T07:54:58.457Z" },
|
|
25
25
|
]
|
|
26
26
|
|
|
27
27
|
[[package]]
|
|
@@ -232,28 +232,16 @@ wheels = [
|
|
|
232
232
|
|
|
233
233
|
[[package]]
|
|
234
234
|
name = "botocore"
|
|
235
|
-
version = "1.
|
|
235
|
+
version = "1.41.5"
|
|
236
236
|
source = { registry = "https://pypi.org/simple" }
|
|
237
237
|
dependencies = [
|
|
238
238
|
{ name = "jmespath" },
|
|
239
239
|
{ name = "python-dateutil" },
|
|
240
240
|
{ name = "urllib3" },
|
|
241
241
|
]
|
|
242
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
243
|
-
wheels = [
|
|
244
|
-
{ url = "https://files.pythonhosted.org/packages/55/d2/507fd0ee4dd574d2bdbdeac5df83f39d2cae1ffe97d4622cca6f6bab39f1/botocore-1.40.70-py3-none-any.whl", hash = "sha256:4a394ad25f5d9f1ef0bed610365744523eeb5c22de6862ab25d8c93f9f6d295c", size = 14106829, upload-time = "2025-11-10T20:29:01.101Z" },
|
|
245
|
-
]
|
|
246
|
-
|
|
247
|
-
[[package]]
|
|
248
|
-
name = "botocore-stubs"
|
|
249
|
-
version = "1.41.5"
|
|
250
|
-
source = { registry = "https://pypi.org/simple" }
|
|
251
|
-
dependencies = [
|
|
252
|
-
{ name = "types-awscrt" },
|
|
253
|
-
]
|
|
254
|
-
sdist = { url = "https://files.pythonhosted.org/packages/85/b6/c93322e1a22120b2db5106b3517d73457378e6776e09d6dee68efe19437b/botocore_stubs-1.41.5.tar.gz", hash = "sha256:6d4c30c59e0cd39031c323d78667d8cdf35463a9ac11757f00b0d224b57b7e44", size = 42405, upload-time = "2025-11-26T21:22:58.088Z" }
|
|
242
|
+
sdist = { url = "https://files.pythonhosted.org/packages/90/22/7fe08c726a2e3b11a0aef8bf177e83891c9cb2dc1809d35c9ed91a9e60e6/botocore-1.41.5.tar.gz", hash = "sha256:0367622b811597d183bfcaab4a350f0d3ede712031ce792ef183cabdee80d3bf", size = 14668152, upload-time = "2025-11-26T20:27:38.026Z" }
|
|
255
243
|
wheels = [
|
|
256
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
244
|
+
{ url = "https://files.pythonhosted.org/packages/4e/4e/21cd0b8f365449f1576f93de1ec8718ed18a7a3bc086dfbdeb79437bba7a/botocore-1.41.5-py3-none-any.whl", hash = "sha256:3fef7fcda30c82c27202d232cfdbd6782cb27f20f8e7e21b20606483e66ee73a", size = 14337008, upload-time = "2025-11-26T20:27:35.208Z" },
|
|
257
245
|
]
|
|
258
246
|
|
|
259
247
|
[[package]]
|
|
@@ -1287,7 +1275,7 @@ dev = [
|
|
|
1287
1275
|
{ name = "ruff" },
|
|
1288
1276
|
{ name = "setuptools" },
|
|
1289
1277
|
{ name = "setuptools-scm" },
|
|
1290
|
-
{ name = "types-aiobotocore"
|
|
1278
|
+
{ name = "types-aiobotocore" },
|
|
1291
1279
|
{ name = "wheel" },
|
|
1292
1280
|
]
|
|
1293
1281
|
testing = [
|
|
@@ -1299,7 +1287,7 @@ testing = [
|
|
|
1299
1287
|
|
|
1300
1288
|
[package.metadata]
|
|
1301
1289
|
requires-dist = [
|
|
1302
|
-
{ name = "aiobotocore", specifier = "~=2.
|
|
1290
|
+
{ name = "aiobotocore", specifier = "~=2.26.0" },
|
|
1303
1291
|
{ name = "aiohttp", extras = ["speedups"], specifier = ">=3.12.0,<3.15.0" },
|
|
1304
1292
|
{ name = "asyncpg", specifier = "~=0.31.0" },
|
|
1305
1293
|
{ name = "lxml", specifier = "~=6.0.2" },
|
|
@@ -1416,28 +1404,28 @@ wheels = [
|
|
|
1416
1404
|
|
|
1417
1405
|
[[package]]
|
|
1418
1406
|
name = "ruff"
|
|
1419
|
-
version = "0.14.
|
|
1420
|
-
source = { registry = "https://pypi.org/simple" }
|
|
1421
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
1422
|
-
wheels = [
|
|
1423
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1424
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1425
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1426
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1427
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1428
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1429
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1430
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1431
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1432
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1433
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1434
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1435
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1436
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1437
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1438
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1439
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1440
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1407
|
+
version = "0.14.7"
|
|
1408
|
+
source = { registry = "https://pypi.org/simple" }
|
|
1409
|
+
sdist = { url = "https://files.pythonhosted.org/packages/b7/5b/dd7406afa6c95e3d8fa9d652b6d6dd17dd4a6bf63cb477014e8ccd3dcd46/ruff-0.14.7.tar.gz", hash = "sha256:3417deb75d23bd14a722b57b0a1435561db65f0ad97435b4cf9f85ffcef34ae5", size = 5727324, upload-time = "2025-11-28T20:55:10.525Z" }
|
|
1410
|
+
wheels = [
|
|
1411
|
+
{ url = "https://files.pythonhosted.org/packages/8c/b1/7ea5647aaf90106f6d102230e5df874613da43d1089864da1553b899ba5e/ruff-0.14.7-py3-none-linux_armv6l.whl", hash = "sha256:b9d5cb5a176c7236892ad7224bc1e63902e4842c460a0b5210701b13e3de4fca", size = 13414475, upload-time = "2025-11-28T20:54:54.569Z" },
|
|
1412
|
+
{ url = "https://files.pythonhosted.org/packages/af/19/fddb4cd532299db9cdaf0efdc20f5c573ce9952a11cb532d3b859d6d9871/ruff-0.14.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:3f64fe375aefaf36ca7d7250292141e39b4cea8250427482ae779a2aa5d90015", size = 13634613, upload-time = "2025-11-28T20:55:17.54Z" },
|
|
1413
|
+
{ url = "https://files.pythonhosted.org/packages/40/2b/469a66e821d4f3de0440676ed3e04b8e2a1dc7575cf6fa3ba6d55e3c8557/ruff-0.14.7-py3-none-macosx_11_0_arm64.whl", hash = "sha256:93e83bd3a9e1a3bda64cb771c0d47cda0e0d148165013ae2d3554d718632d554", size = 12765458, upload-time = "2025-11-28T20:55:26.128Z" },
|
|
1414
|
+
{ url = "https://files.pythonhosted.org/packages/f1/05/0b001f734fe550bcfde4ce845948ac620ff908ab7241a39a1b39bb3c5f49/ruff-0.14.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3838948e3facc59a6070795de2ae16e5786861850f78d5914a03f12659e88f94", size = 13236412, upload-time = "2025-11-28T20:55:28.602Z" },
|
|
1415
|
+
{ url = "https://files.pythonhosted.org/packages/11/36/8ed15d243f011b4e5da75cd56d6131c6766f55334d14ba31cce5461f28aa/ruff-0.14.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:24c8487194d38b6d71cd0fd17a5b6715cda29f59baca1defe1e3a03240f851d1", size = 13182949, upload-time = "2025-11-28T20:55:33.265Z" },
|
|
1416
|
+
{ url = "https://files.pythonhosted.org/packages/3b/cf/fcb0b5a195455729834f2a6eadfe2e4519d8ca08c74f6d2b564a4f18f553/ruff-0.14.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:79c73db6833f058a4be8ffe4a0913b6d4ad41f6324745179bd2aa09275b01d0b", size = 13816470, upload-time = "2025-11-28T20:55:08.203Z" },
|
|
1417
|
+
{ url = "https://files.pythonhosted.org/packages/7f/5d/34a4748577ff7a5ed2f2471456740f02e86d1568a18c9faccfc73bd9ca3f/ruff-0.14.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:12eb7014fccff10fc62d15c79d8a6be4d0c2d60fe3f8e4d169a0d2def75f5dad", size = 15289621, upload-time = "2025-11-28T20:55:30.837Z" },
|
|
1418
|
+
{ url = "https://files.pythonhosted.org/packages/53/53/0a9385f047a858ba133d96f3f8e3c9c66a31cc7c4b445368ef88ebeac209/ruff-0.14.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6c623bbdc902de7ff715a93fa3bb377a4e42dd696937bf95669118773dbf0c50", size = 14975817, upload-time = "2025-11-28T20:55:24.107Z" },
|
|
1419
|
+
{ url = "https://files.pythonhosted.org/packages/a8/d7/2f1c32af54c3b46e7fadbf8006d8b9bcfbea535c316b0bd8813d6fb25e5d/ruff-0.14.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f53accc02ed2d200fa621593cdb3c1ae06aa9b2c3cae70bc96f72f0000ae97a9", size = 14284549, upload-time = "2025-11-28T20:55:06.08Z" },
|
|
1420
|
+
{ url = "https://files.pythonhosted.org/packages/92/05/434ddd86becd64629c25fb6b4ce7637dd52a45cc4a4415a3008fe61c27b9/ruff-0.14.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:281f0e61a23fcdcffca210591f0f53aafaa15f9025b5b3f9706879aaa8683bc4", size = 14071389, upload-time = "2025-11-28T20:55:35.617Z" },
|
|
1421
|
+
{ url = "https://files.pythonhosted.org/packages/ff/50/fdf89d4d80f7f9d4f420d26089a79b3bb1538fe44586b148451bc2ba8d9c/ruff-0.14.7-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:dbbaa5e14148965b91cb090236931182ee522a5fac9bc5575bafc5c07b9f9682", size = 14202679, upload-time = "2025-11-28T20:55:01.472Z" },
|
|
1422
|
+
{ url = "https://files.pythonhosted.org/packages/77/54/87b34988984555425ce967f08a36df0ebd339bb5d9d0e92a47e41151eafc/ruff-0.14.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:1464b6e54880c0fe2f2d6eaefb6db15373331414eddf89d6b903767ae2458143", size = 13147677, upload-time = "2025-11-28T20:55:19.933Z" },
|
|
1423
|
+
{ url = "https://files.pythonhosted.org/packages/67/29/f55e4d44edfe053918a16a3299e758e1c18eef216b7a7092550d7a9ec51c/ruff-0.14.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:f217ed871e4621ea6128460df57b19ce0580606c23aeab50f5de425d05226784", size = 13151392, upload-time = "2025-11-28T20:55:21.967Z" },
|
|
1424
|
+
{ url = "https://files.pythonhosted.org/packages/36/69/47aae6dbd4f1d9b4f7085f4d9dcc84e04561ee7ad067bf52e0f9b02e3209/ruff-0.14.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:6be02e849440ed3602d2eb478ff7ff07d53e3758f7948a2a598829660988619e", size = 13412230, upload-time = "2025-11-28T20:55:12.749Z" },
|
|
1425
|
+
{ url = "https://files.pythonhosted.org/packages/b7/4b/6e96cb6ba297f2ba502a231cd732ed7c3de98b1a896671b932a5eefa3804/ruff-0.14.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:19a0f116ee5e2b468dfe80c41c84e2bbd6b74f7b719bee86c2ecde0a34563bcc", size = 14195397, upload-time = "2025-11-28T20:54:56.896Z" },
|
|
1426
|
+
{ url = "https://files.pythonhosted.org/packages/69/82/251d5f1aa4dcad30aed491b4657cecd9fb4274214da6960ffec144c260f7/ruff-0.14.7-py3-none-win32.whl", hash = "sha256:e33052c9199b347c8937937163b9b149ef6ab2e4bb37b042e593da2e6f6cccfa", size = 13126751, upload-time = "2025-11-28T20:55:03.47Z" },
|
|
1427
|
+
{ url = "https://files.pythonhosted.org/packages/a8/b5/d0b7d145963136b564806f6584647af45ab98946660d399ec4da79cae036/ruff-0.14.7-py3-none-win_amd64.whl", hash = "sha256:e17a20ad0d3fad47a326d773a042b924d3ac31c6ca6deb6c72e9e6b5f661a7c6", size = 14531726, upload-time = "2025-11-28T20:54:59.121Z" },
|
|
1428
|
+
{ url = "https://files.pythonhosted.org/packages/1d/d2/1637f4360ada6a368d3265bf39f2cf737a0aaab15ab520fc005903e883f8/ruff-0.14.7-py3-none-win_arm64.whl", hash = "sha256:be4d653d3bea1b19742fcc6502354e32f65cd61ff2fbdb365803ef2c2aec6228", size = 13609215, upload-time = "2025-11-28T20:55:15.375Z" },
|
|
1441
1429
|
]
|
|
1442
1430
|
|
|
1443
1431
|
[[package]]
|
|
@@ -1499,37 +1487,11 @@ asyncio = [
|
|
|
1499
1487
|
|
|
1500
1488
|
[[package]]
|
|
1501
1489
|
name = "types-aiobotocore"
|
|
1502
|
-
version = "2.
|
|
1503
|
-
source = { registry = "https://pypi.org/simple" }
|
|
1504
|
-
dependencies = [
|
|
1505
|
-
{ name = "botocore-stubs" },
|
|
1506
|
-
]
|
|
1507
|
-
sdist = { url = "https://files.pythonhosted.org/packages/77/b3/15e487a2a84ca827cbd80af1de4485d25dc3014f3122d8069665bee725bc/types_aiobotocore-2.25.2.tar.gz", hash = "sha256:6b2458ac1c0999de0ba4a1dcfbf3bc0d5c7ca2ea0c72f6732abe67d08ebf0240", size = 85272, upload-time = "2025-11-12T01:58:58.83Z" }
|
|
1508
|
-
wheels = [
|
|
1509
|
-
{ url = "https://files.pythonhosted.org/packages/fe/1f/0115f843090b969ef4902eb8ef128c613fdc91787c34a4b9e4140cf763fa/types_aiobotocore-2.25.2-py3-none-any.whl", hash = "sha256:b6027aa2dc020a9e2eeaa0ab9178f5c2cb6bb5e07613b7ea26174cc491d33b39", size = 53655, upload-time = "2025-11-12T01:58:55.575Z" },
|
|
1510
|
-
]
|
|
1511
|
-
|
|
1512
|
-
[package.optional-dependencies]
|
|
1513
|
-
s3 = [
|
|
1514
|
-
{ name = "types-aiobotocore-s3" },
|
|
1515
|
-
]
|
|
1516
|
-
|
|
1517
|
-
[[package]]
|
|
1518
|
-
name = "types-aiobotocore-s3"
|
|
1519
|
-
version = "2.25.2"
|
|
1520
|
-
source = { registry = "https://pypi.org/simple" }
|
|
1521
|
-
sdist = { url = "https://files.pythonhosted.org/packages/a7/c6/9bb91a44eed1114690edb15d8251f32392e355dfa0a5b8e1c190b4cf89a4/types_aiobotocore_s3-2.25.2.tar.gz", hash = "sha256:678aa425491af19bd6d011d59ecdbbb7ae7e95800efddcf4fd559ab72c94e194", size = 75955, upload-time = "2025-11-12T01:52:06.536Z" }
|
|
1522
|
-
wheels = [
|
|
1523
|
-
{ url = "https://files.pythonhosted.org/packages/b4/0a/d0d9faefd7caa8536eb97647c38c711e73ab83341a65119d08c2cb20957d/types_aiobotocore_s3-2.25.2-py3-none-any.whl", hash = "sha256:151301e84bb2f1cbf30f0d1ef791bb75c141cfbfe47b93fd317b7f1ba3eb35e4", size = 83626, upload-time = "2025-11-12T01:52:04.763Z" },
|
|
1524
|
-
]
|
|
1525
|
-
|
|
1526
|
-
[[package]]
|
|
1527
|
-
name = "types-awscrt"
|
|
1528
|
-
version = "0.29.0"
|
|
1490
|
+
version = "2.26.0.post1"
|
|
1529
1491
|
source = { registry = "https://pypi.org/simple" }
|
|
1530
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
1492
|
+
sdist = { url = "https://files.pythonhosted.org/packages/25/1a/282cf6eec5ff6e9c9ddcf7009176554f22c0862d5daeb5bdc467571ef9ea/types_aiobotocore-2.26.0.post1.tar.gz", hash = "sha256:a0aadb9dfd10ecb2bca4b2eac59c71a7536b50145f3027aebf80084589252ed4", size = 13393, upload-time = "2025-11-30T08:20:42Z" }
|
|
1531
1493
|
wheels = [
|
|
1532
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1494
|
+
{ url = "https://files.pythonhosted.org/packages/70/0a/98364f7c1237af4ab30ae7adedb7afe6470e143347903e29f9b463c53314/types_aiobotocore-2.26.0.post1-py3-none-any.whl", hash = "sha256:de72760a09029ef74c92cf07e8081f5286d1d0f78a509e86b491d9aecb6a4f38", size = 22506, upload-time = "2025-11-30T08:20:40.634Z" },
|
|
1533
1495
|
]
|
|
1534
1496
|
|
|
1535
1497
|
[[package]]
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
import io
|
|
3
|
-
import logging
|
|
4
|
-
from datetime import UTC, datetime
|
|
5
|
-
from typing import TYPE_CHECKING
|
|
6
|
-
from uuid import uuid4
|
|
7
|
-
|
|
8
|
-
from lxml import etree
|
|
9
|
-
from zeep.plugins import Plugin
|
|
10
|
-
|
|
11
|
-
from python3_commons import object_storage
|
|
12
|
-
from python3_commons.conf import S3Settings, s3_settings
|
|
13
|
-
|
|
14
|
-
if TYPE_CHECKING:
|
|
15
|
-
from zeep.wsdl.definitions import AbstractOperation
|
|
16
|
-
|
|
17
|
-
logger = logging.getLogger(__name__)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
# class GeneratedStream(io.BytesIO):
|
|
21
|
-
# def __init__(self, generator: AsyncGenerator[bytes], *args, **kwargs):
|
|
22
|
-
# super().__init__(*args, **kwargs)
|
|
23
|
-
# self.generator = generator
|
|
24
|
-
#
|
|
25
|
-
# def read(self, size: int = -1):
|
|
26
|
-
# if size < 0:
|
|
27
|
-
# while True:
|
|
28
|
-
# try:
|
|
29
|
-
# chunk = anext(self.generator)
|
|
30
|
-
# except StopIteration:
|
|
31
|
-
# break
|
|
32
|
-
# else:
|
|
33
|
-
# self.write(chunk)
|
|
34
|
-
# else:
|
|
35
|
-
# total_written_size = 0
|
|
36
|
-
#
|
|
37
|
-
# while total_written_size < size:
|
|
38
|
-
# try:
|
|
39
|
-
# chunk = anext(self.generator)
|
|
40
|
-
# except StopIteration:
|
|
41
|
-
# break
|
|
42
|
-
# else:
|
|
43
|
-
# total_written_size += self.write(chunk)
|
|
44
|
-
#
|
|
45
|
-
# self.seek(0)
|
|
46
|
-
#
|
|
47
|
-
# if chunk := super().read(size):
|
|
48
|
-
# pos = self.tell()
|
|
49
|
-
#
|
|
50
|
-
# buf = self.getbuffer()
|
|
51
|
-
# unread_data_size = len(buf) - pos
|
|
52
|
-
#
|
|
53
|
-
# if unread_data_size > 0:
|
|
54
|
-
# buf[:unread_data_size] = buf[pos : pos + unread_data_size]
|
|
55
|
-
#
|
|
56
|
-
# del buf
|
|
57
|
-
#
|
|
58
|
-
# self.seek(0)
|
|
59
|
-
# self.truncate(unread_data_size)
|
|
60
|
-
#
|
|
61
|
-
# return chunk
|
|
62
|
-
#
|
|
63
|
-
# def readable(self):
|
|
64
|
-
# return True
|
|
65
|
-
#
|
|
66
|
-
#
|
|
67
|
-
# async def generate_archive(
|
|
68
|
-
# objects: AsyncGenerator[tuple[str, datetime, bytes]], chunk_size: int = 4096
|
|
69
|
-
# ) -> AsyncGenerator[bytes]:
|
|
70
|
-
# buffer = deque()
|
|
71
|
-
#
|
|
72
|
-
# with tarfile.open(fileobj=buffer, mode='w') as archive:
|
|
73
|
-
# async for name, last_modified, content in objects:
|
|
74
|
-
# logger.info(f'Adding {name} to archive')
|
|
75
|
-
# info = tarfile.TarInfo(name)
|
|
76
|
-
# info.size = len(content)
|
|
77
|
-
# info.mtime = int(last_modified.timestamp())
|
|
78
|
-
# archive.addfile(info, io.BytesIO(content))
|
|
79
|
-
#
|
|
80
|
-
# buffer_length = buffer.tell()
|
|
81
|
-
#
|
|
82
|
-
# while buffer_length >= chunk_size:
|
|
83
|
-
# buffer.seek(0)
|
|
84
|
-
# chunk = buffer.read(chunk_size)
|
|
85
|
-
# chunk_len = len(chunk)
|
|
86
|
-
#
|
|
87
|
-
# if not chunk:
|
|
88
|
-
# break
|
|
89
|
-
#
|
|
90
|
-
# yield chunk
|
|
91
|
-
#
|
|
92
|
-
# buffer.seek(0)
|
|
93
|
-
# buffer.truncate(chunk_len)
|
|
94
|
-
# buffer.seek(0, io.SEEK_END)
|
|
95
|
-
# buffer_length = buffer.tell()
|
|
96
|
-
#
|
|
97
|
-
# while True:
|
|
98
|
-
# chunk = buffer.read(chunk_size)
|
|
99
|
-
#
|
|
100
|
-
# if not chunk:
|
|
101
|
-
# break
|
|
102
|
-
#
|
|
103
|
-
# yield chunk
|
|
104
|
-
#
|
|
105
|
-
# buffer.seek(0)
|
|
106
|
-
# buffer.truncate(0)
|
|
107
|
-
#
|
|
108
|
-
#
|
|
109
|
-
# async def generate_bzip2(chunks: AsyncGenerator[bytes]) -> AsyncGenerator[bytes]:
|
|
110
|
-
# compressor = BZ2Compressor()
|
|
111
|
-
#
|
|
112
|
-
# async for chunk in chunks:
|
|
113
|
-
# if compressed_chunk := compressor.compress(chunk):
|
|
114
|
-
# yield compressed_chunk
|
|
115
|
-
#
|
|
116
|
-
# if compressed_chunk := compressor.flush():
|
|
117
|
-
# yield compressed_chunk
|
|
118
|
-
#
|
|
119
|
-
|
|
120
|
-
# async def archive_audit_data(root_path: str = 'audit'):
|
|
121
|
-
# now = datetime.now(tz=UTC) - timedelta(days=1)
|
|
122
|
-
# year = now.year
|
|
123
|
-
# month = now.month
|
|
124
|
-
# day = now.day
|
|
125
|
-
# bucket_name = s3_settings.s3_bucket
|
|
126
|
-
# date_path = object_storage.get_absolute_path(f'{root_path}/{year}/{month:02}/{day:02}')
|
|
127
|
-
#
|
|
128
|
-
# if objects := object_storage.get_objects(bucket_name, date_path, recursive=True):
|
|
129
|
-
# logger.info(f'Compacting files in: {date_path}')
|
|
130
|
-
#
|
|
131
|
-
# generator = generate_archive(objects, chunk_size=900_000)
|
|
132
|
-
# bzip2_generator = generate_bzip2(generator)
|
|
133
|
-
# archive_stream = GeneratedStream(bzip2_generator)
|
|
134
|
-
#
|
|
135
|
-
# archive_path = object_storage.get_absolute_path(f'audit/.archive/{year}_{month:02}_{day:02}.tar.bz2')
|
|
136
|
-
# await object_storage.put_object(bucket_name, archive_path, archive_stream, -1, part_size=5 * 1024 * 1024)
|
|
137
|
-
#
|
|
138
|
-
# if errors := await object_storage.remove_objects(bucket_name, date_path):
|
|
139
|
-
# for error in errors:
|
|
140
|
-
# logger.error(f'Failed to delete object in {bucket_name=}: {error}')
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
async def write_audit_data(settings: S3Settings, key: str, data: bytes) -> None:
|
|
144
|
-
if settings.aws_secret_access_key:
|
|
145
|
-
try:
|
|
146
|
-
absolute_path = object_storage.get_absolute_path(f'audit/{key}')
|
|
147
|
-
|
|
148
|
-
await object_storage.put_object(settings.s3_bucket, absolute_path, io.BytesIO(data), len(data))
|
|
149
|
-
except Exception:
|
|
150
|
-
logger.exception('Failed storing object in storage.')
|
|
151
|
-
else:
|
|
152
|
-
logger.debug(f'Stored object in storage: {key}')
|
|
153
|
-
else:
|
|
154
|
-
logger.debug(f'S3 is not configured, not storing object in storage: {key}')
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
class ZeepAuditPlugin(Plugin):
|
|
158
|
-
def __init__(self, audit_name: str = 'zeep') -> None:
|
|
159
|
-
super().__init__()
|
|
160
|
-
self.audit_name = audit_name
|
|
161
|
-
|
|
162
|
-
def store_audit_in_s3(self, envelope, operation: AbstractOperation, direction: str) -> None:
|
|
163
|
-
xml = etree.tostring(envelope, encoding='UTF-8', pretty_print=True)
|
|
164
|
-
now = datetime.now(tz=UTC)
|
|
165
|
-
date_path = now.strftime('%Y/%m/%d')
|
|
166
|
-
timestamp = now.strftime('%H%M%S')
|
|
167
|
-
path = f'{date_path}/{self.audit_name}/{operation.name}/{timestamp}_{str(uuid4())[-12:]}_{direction}.xml'
|
|
168
|
-
coro = write_audit_data(s3_settings, path, xml)
|
|
169
|
-
|
|
170
|
-
try:
|
|
171
|
-
loop = asyncio.get_running_loop()
|
|
172
|
-
except RuntimeError:
|
|
173
|
-
loop = None
|
|
174
|
-
|
|
175
|
-
if loop and loop.is_running():
|
|
176
|
-
loop.create_task(coro)
|
|
177
|
-
else:
|
|
178
|
-
asyncio.run(coro)
|
|
179
|
-
|
|
180
|
-
def ingress(self, envelope, http_headers, operation: AbstractOperation):
|
|
181
|
-
self.store_audit_in_s3(envelope, operation, 'ingress')
|
|
182
|
-
|
|
183
|
-
return envelope, http_headers
|
|
184
|
-
|
|
185
|
-
def egress(self, envelope, http_headers, operation: AbstractOperation, binding_options):
|
|
186
|
-
self.store_audit_in_s3(envelope, operation, 'egress')
|
|
187
|
-
|
|
188
|
-
return envelope, http_headers
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python3_commons-0.14.10 → python3_commons-0.14.11}/.github/workflows/release-on-tag-push.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/db/models/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/serializers/__init__.py
RENAMED
|
File without changes
|
{python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/serializers/common.py
RENAMED
|
File without changes
|
|
File without changes
|
{python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/serializers/msgpack.py
RENAMED
|
File without changes
|
{python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons/serializers/msgspec.py
RENAMED
|
File without changes
|
{python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{python3_commons-0.14.10 → python3_commons-0.14.11}/src/python3_commons.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|