aws-python-helper 1.15.2__tar.gz → 1.15.3__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.
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/PKG-INFO +1 -1
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/utils/json_encoder.py +10 -1
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper.egg-info/PKG-INFO +1 -1
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper.egg-info/SOURCES.txt +1 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/pyproject.toml +1 -1
- aws_python_helper-1.15.3/tests/test_json_encoder.py +51 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/README.md +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/__init__.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/api/__init__.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/api/auth_middleware.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/api/auth_validators.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/api/base.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/api/dispatcher.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/api/exceptions.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/api/fetcher.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/api/handler.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/api/jwt_keys.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/context/__init__.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/context/session.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/context/state_validator.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/database/__init__.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/database/database_proxy.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/database/external_database_proxy.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/database/external_mongo_manager.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/database/mongo_manager.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/fargate/__init__.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/fargate/executor.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/fargate/fetcher.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/fargate/handler.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/fargate/task_base.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/invoker/__init__.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/invoker/api_client.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/invoker/exceptions.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/invoker/lambda_invoker.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/lambda_standalone/__init__.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/lambda_standalone/base.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/lambda_standalone/fetcher.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/lambda_standalone/handler.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/model_index_sync/__init__.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/model_index_sync/base.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/model_query/__init__.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/model_query/base.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/monitoring/__init__.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/monitoring/run.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/permissions/__init__.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/permissions/catalog.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/repository/__init__.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/repository/audit.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/repository/base.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/settings.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/sns/__init__.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/sns/publisher.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/sqs/__init__.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/sqs/consumer_base.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/sqs/fetcher.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/sqs/handler.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/utils/__init__.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/utils/response.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/utils/serializer.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper.egg-info/dependency_links.txt +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper.egg-info/requires.txt +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper.egg-info/top_level.txt +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/setup.cfg +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/tests/test_audit_stamp.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/tests/test_jwt_keys.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/tests/test_model_query_schema.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/tests/test_settings.py +0 -0
- {aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/tests/test_sns_publisher.py +0 -0
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/utils/json_encoder.py
RENAMED
|
@@ -3,7 +3,7 @@ MongoDB JSON Encoder - Custom JSON encoder to handle MongoDB types
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
|
-
from datetime import datetime, date
|
|
6
|
+
from datetime import datetime, date, timezone
|
|
7
7
|
from decimal import Decimal
|
|
8
8
|
from typing import Any
|
|
9
9
|
|
|
@@ -68,6 +68,15 @@ class MongoJSONEncoder(json.JSONEncoder):
|
|
|
68
68
|
|
|
69
69
|
# Python datetime
|
|
70
70
|
if isinstance(obj, datetime):
|
|
71
|
+
# Sin zona se asume UTC, que es lo que Mongo guarda y lo que el
|
|
72
|
+
# driver devuelve —naive— salvo que se lo configure para otra cosa.
|
|
73
|
+
#
|
|
74
|
+
# Sin esto la cadena sale sin marca y quien la lee la toma como hora
|
|
75
|
+
# local: en un navegador en UTC-5, un servicio que se anunció hace
|
|
76
|
+
# un minuto aparecía anunciándose "dentro de 5 horas". No falla
|
|
77
|
+
# nada, simplemente dice otra cosa.
|
|
78
|
+
if obj.tzinfo is None:
|
|
79
|
+
obj = obj.replace(tzinfo=timezone.utc)
|
|
71
80
|
return obj.isoformat()
|
|
72
81
|
|
|
73
82
|
# Python date
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper.egg-info/SOURCES.txt
RENAMED
|
@@ -59,6 +59,7 @@ aws_python_helper/utils/json_encoder.py
|
|
|
59
59
|
aws_python_helper/utils/response.py
|
|
60
60
|
aws_python_helper/utils/serializer.py
|
|
61
61
|
tests/test_audit_stamp.py
|
|
62
|
+
tests/test_json_encoder.py
|
|
62
63
|
tests/test_jwt_keys.py
|
|
63
64
|
tests/test_model_query_schema.py
|
|
64
65
|
tests/test_settings.py
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""Una fecha que sale de acá dice en qué zona está.
|
|
2
|
+
|
|
3
|
+
Mongo guarda UTC y el driver la devuelve sin marca de zona. Mandada así, quien
|
|
4
|
+
la lee la toma como hora local: en un navegador en UTC-5, algo que pasó hace un
|
|
5
|
+
minuto se mostraba como "dentro de 5 horas". No falla nada — dice otra cosa.
|
|
6
|
+
|
|
7
|
+
../constitution-core/venv/bin/python tests/test_json_encoder.py
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import json
|
|
11
|
+
import os
|
|
12
|
+
import sys
|
|
13
|
+
from datetime import datetime, timedelta, timezone
|
|
14
|
+
|
|
15
|
+
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
16
|
+
|
|
17
|
+
from aws_python_helper.utils.json_encoder import MongoJSONEncoder
|
|
18
|
+
|
|
19
|
+
failures = []
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def check(label, condition):
|
|
23
|
+
print(f" {'ok ' if condition else 'FALLA'} {label}")
|
|
24
|
+
if not condition:
|
|
25
|
+
failures.append(label)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
print("== una fecha sin zona sale como UTC ==")
|
|
29
|
+
naive = datetime(2026, 10, 1, 17, 25, 55)
|
|
30
|
+
salida = json.loads(json.dumps({"at": naive}, cls=MongoJSONEncoder))["at"]
|
|
31
|
+
print(f" {salida}")
|
|
32
|
+
check("lleva la marca de zona", salida.endswith("+00:00") or salida.endswith("Z"))
|
|
33
|
+
check("no corre la hora", salida.startswith("2026-10-01T17:25:55"))
|
|
34
|
+
|
|
35
|
+
print("\n== una que ya la trae se respeta ==")
|
|
36
|
+
aware = datetime(2026, 10, 1, 17, 25, 55, tzinfo=timezone(timedelta(hours=-5)))
|
|
37
|
+
salida = json.loads(json.dumps({"at": aware}, cls=MongoJSONEncoder))["at"]
|
|
38
|
+
print(f" {salida}")
|
|
39
|
+
check("conserva su propia zona", salida.endswith("-05:00"))
|
|
40
|
+
|
|
41
|
+
print("\n== y una fecha sin hora no se toca ==")
|
|
42
|
+
from datetime import date as _date
|
|
43
|
+
salida = json.loads(json.dumps({"on": _date(2026, 10, 1)}, cls=MongoJSONEncoder))["on"]
|
|
44
|
+
print(f" {salida}")
|
|
45
|
+
check("sigue siendo una fecha", salida == "2026-10-01")
|
|
46
|
+
|
|
47
|
+
print()
|
|
48
|
+
if failures:
|
|
49
|
+
print(f"{len(failures)} fallas")
|
|
50
|
+
sys.exit(1)
|
|
51
|
+
print("all good")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/api/auth_middleware.py
RENAMED
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/api/auth_validators.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
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/context/state_validator.py
RENAMED
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/database/__init__.py
RENAMED
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/database/database_proxy.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/database/mongo_manager.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/fargate/task_base.py
RENAMED
|
File without changes
|
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/invoker/api_client.py
RENAMED
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/invoker/exceptions.py
RENAMED
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/invoker/lambda_invoker.py
RENAMED
|
File without changes
|
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/lambda_standalone/base.py
RENAMED
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/lambda_standalone/fetcher.py
RENAMED
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/lambda_standalone/handler.py
RENAMED
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/model_index_sync/__init__.py
RENAMED
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/model_index_sync/base.py
RENAMED
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/model_query/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/monitoring/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/permissions/__init__.py
RENAMED
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/permissions/catalog.py
RENAMED
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/repository/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper/sqs/consumer_base.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper.egg-info/requires.txt
RENAMED
|
File without changes
|
{aws_python_helper-1.15.2 → aws_python_helper-1.15.3}/aws_python_helper.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
|