internal 1.0.105__tar.gz → 1.0.107__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.
Potentially problematic release.
This version of internal might be problematic. Click here for more details.
- {internal-1.0.105 → internal-1.0.107}/PKG-INFO +2 -1
- {internal-1.0.105 → internal-1.0.107}/pyproject.toml +2 -1
- {internal-1.0.105 → internal-1.0.107}/src/internal/base_factory.py +6 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/const.py +1 -1
- internal-1.0.107/src/internal/log_config.py +32 -0
- internal-1.0.105/src/internal/common_enum/event_trigger_type.py +0 -34
- internal-1.0.105/src/internal/common_enum/feature.py +0 -6
- internal-1.0.105/src/internal/common_enum/notify_type.py +0 -10
- {internal-1.0.105 → internal-1.0.107}/README.md +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/__init__.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/base_config.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/cache_redis.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/common_enum/__init__.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/common_enum/contact_type.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/common_enum/description_type.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/common_enum/device_code.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/common_enum/event_code.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/common_enum/lpr_direction.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/common_enum/operator_type.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/common_enum/order_type.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/database.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/exception/__init__.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/exception/app_exception.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/exception/base_exception.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/exception/internal_exception.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/ext/__init__.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/ext/amazon/__init__.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/ext/amazon/aws/__init__.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/ext/amazon/aws/const.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/http/__init__.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/http/requests.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/http/responses.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/interface/__init__.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/interface/base_interface.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/middleware/__init__.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/middleware/log_request.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/model/__init__.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/model/base_model.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/model/operate.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/utils.py +0 -0
- {internal-1.0.105 → internal-1.0.107}/src/internal/validator_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: internal
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.107
|
|
4
4
|
Summary:
|
|
5
5
|
Author: Ray
|
|
6
6
|
Author-email: ray@cruisys.com
|
|
@@ -10,6 +10,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.12
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.13
|
|
12
12
|
Requires-Dist: arrow (>=1.3.0,<2.0.0)
|
|
13
|
+
Requires-Dist: asgi-correlation-id (>=4.3.4,<5.0.0)
|
|
13
14
|
Requires-Dist: beanie (>=1.29.0,<2.0.0)
|
|
14
15
|
Requires-Dist: dictdiffer (>=0.9.0,<0.10.0)
|
|
15
16
|
Requires-Dist: fastapi (>=0.115.6,<0.116.0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "internal"
|
|
3
|
-
version = "1.0.
|
|
3
|
+
version = "1.0.107"
|
|
4
4
|
description = ""
|
|
5
5
|
authors = [{ name = "Ray", email = "ray@cruisys.com" }]
|
|
6
6
|
readme = "README.md"
|
|
@@ -19,6 +19,7 @@ beanie = "^1.29.0"
|
|
|
19
19
|
dictdiffer = "^0.9.0"
|
|
20
20
|
redis = "^5.2.1"
|
|
21
21
|
uvicorn = "^0.34.0"
|
|
22
|
+
asgi-correlation-id = "^4.3.4"
|
|
22
23
|
|
|
23
24
|
[build-system]
|
|
24
25
|
requires = ["poetry-core"]
|
|
@@ -5,6 +5,7 @@ import traceback
|
|
|
5
5
|
from abc import ABCMeta, abstractmethod
|
|
6
6
|
from contextlib import asynccontextmanager
|
|
7
7
|
from functools import lru_cache
|
|
8
|
+
from asgi_correlation_id import CorrelationIdMiddleware
|
|
8
9
|
|
|
9
10
|
import dotenv
|
|
10
11
|
import watchtower
|
|
@@ -20,6 +21,7 @@ from .exception.internal_exception import BadGatewayException, GatewayTimeoutExc
|
|
|
20
21
|
from .ext.amazon import aws
|
|
21
22
|
from .http.requests import async_request
|
|
22
23
|
from .http.responses import async_response
|
|
24
|
+
from .log_config import LOGGING
|
|
23
25
|
from .middleware.log_request import LogRequestMiddleware
|
|
24
26
|
from .utils import update_dict_with_cast
|
|
25
27
|
|
|
@@ -115,8 +117,11 @@ class BaseFactory(metaclass=ABCMeta):
|
|
|
115
117
|
allow_credentials=True,
|
|
116
118
|
allow_methods=["*"],
|
|
117
119
|
allow_headers=["*"],
|
|
120
|
+
expose_headers=['X-Request-ID']
|
|
118
121
|
)
|
|
119
122
|
|
|
123
|
+
app.add_middleware(CorrelationIdMiddleware)
|
|
124
|
+
|
|
120
125
|
self.__load_local_config()
|
|
121
126
|
app.state.config = self.get_app_config()
|
|
122
127
|
self.__setup_main_logger(app, level=logging.DEBUG)
|
|
@@ -227,6 +232,7 @@ class BaseFactory(metaclass=ABCMeta):
|
|
|
227
232
|
|
|
228
233
|
#
|
|
229
234
|
def __setup_logger(self, app, logger_name, level=logging.INFO):
|
|
235
|
+
logging.config.dictConfig(LOGGING)
|
|
230
236
|
logger = logging.getLogger(logger_name)
|
|
231
237
|
logger.setLevel(level)
|
|
232
238
|
|
|
@@ -7,7 +7,7 @@ DT_FMT = f"{DATE_FMT} {TIME_FMT}:%S"
|
|
|
7
7
|
|
|
8
8
|
DEFAULT_LOGGER_NAME = "uvicorn"
|
|
9
9
|
LOG_DT_FMT = f"{DT_FMT},%03d"
|
|
10
|
-
LOG_FMT_NO_DT = "[%(levelname)7s][%(name)s][%(filename)s::%(funcName)s(%(lineno)s)]: %(message)s"
|
|
10
|
+
LOG_FMT_NO_DT = "[%(levelname)7s][%(correlation_id)s][%(name)s][%(filename)s::%(funcName)s(%(lineno)s)]: %(message)s"
|
|
11
11
|
LOG_FMT = "[%(asctime)s]" + LOG_FMT_NO_DT
|
|
12
12
|
|
|
13
13
|
ARR_EXPORT_SHORT_FMT = "MM/DD HH:mm"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
LOGGING = {
|
|
2
|
+
'version': 1,
|
|
3
|
+
'disable_existing_loggers': False,
|
|
4
|
+
'filters': {
|
|
5
|
+
'correlation_id': {
|
|
6
|
+
'()': 'asgi_correlation_id.CorrelationIdFilter',
|
|
7
|
+
'uuid_length': 32,
|
|
8
|
+
'default_value': '-',
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
'formatters': {
|
|
12
|
+
'web': {
|
|
13
|
+
'class': 'logging.Formatter',
|
|
14
|
+
'datefmt': '%H:%M:%S',
|
|
15
|
+
'format': '%(levelname)s ... [%(correlation_id)s] %(name)s %(message)s',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
'handlers': {
|
|
19
|
+
'web': {
|
|
20
|
+
'class': 'logging.StreamHandler',
|
|
21
|
+
'filters': ['correlation_id'],
|
|
22
|
+
'formatter': 'web',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
'loggers': {
|
|
26
|
+
'my_project': {
|
|
27
|
+
'handlers': ['web'],
|
|
28
|
+
'level': 'DEBUG',
|
|
29
|
+
'propagate': True,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
from enum import Enum
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
# 待廢
|
|
5
|
-
class EventTriggerTypeEnum(str, Enum):
|
|
6
|
-
MANUAL_CANCEL_SERVICE_TICKET = "manual_cancel_service_ticket"
|
|
7
|
-
MANUAL_TRACING_START_SERVICE_TICKET = "manual_tracking_start_service_ticket"
|
|
8
|
-
MANUAL_TRACING_STOP_SERVICE_TICKET = "manual_tracking_stop_service_ticket"
|
|
9
|
-
MANUAL_CREATE_SERVICE_TICKET = "manual_create_service_ticket"
|
|
10
|
-
MANUAL_IMPORT_RESERVATION_SMWS = "manual_import_reservation_smws"
|
|
11
|
-
MANUAL_MODIFY_USER_SERVICE_TICKET = "manual_modify_user_service_ticket"
|
|
12
|
-
MANUAL_MODIFY_ESTIMATED_ARRIVAL_TIME_SERVICE_TICKET = "manual_modify_estimated_arrival_time_service_ticket"
|
|
13
|
-
MANUAL_MODIFY_ESTIMATED_DELIVERY_TIME_SERVICE_TICKET = "manual_modify_estimated_delivery_time_service_ticket"
|
|
14
|
-
MANUAL_DELETE_ESTIMATED_DELIVERY_TIME_SERVICE_TICKET = "manual_delete_estimated_delivery_time_service_ticket"
|
|
15
|
-
MANUAL_BOOKING_MESSAGE_SERVICE_TICKET = "manual_booking_message_service_ticket"
|
|
16
|
-
MANUAL_DELIVERY_MESSAGE_SERVICE_TICKET = "manual_delivery_message_service_ticket"
|
|
17
|
-
|
|
18
|
-
NOSHOW_SERVICE_TICKET_AUTO_CANCEL = "noshow_service_ticket_auto_cancel"
|
|
19
|
-
IMPORT_RESERVATION_CONFLICT_AUTO_CANCEL = "import_reservation_conflict_auto_cancel"
|
|
20
|
-
BOOKING_REMINDING_SERVICE_TICKET = "booking_reminding_service_ticket"
|
|
21
|
-
TODAY_REPAIR_WORKING_SERVICE_TICKET_AUTO_CLOSED = "today_repair_working_service_ticket_auto_closed"
|
|
22
|
-
|
|
23
|
-
LPNR_IN_ESTABLISHED = "lpnr_in_established"
|
|
24
|
-
LPNR_IN_RECEPTION = "lpnr_in_reception"
|
|
25
|
-
LPNR_IN_WORKING = "lpnr_in_working"
|
|
26
|
-
LPNR_IN_NO_SERVICE_TICKET = "lpnr_in_no_service_ticket"
|
|
27
|
-
LPNR_OUT = "lpnr_out"
|
|
28
|
-
LPNR_OUT_GENERAL = "lpnr_out_general"
|
|
29
|
-
LPNR_OUT_NO_SERVE = "lpnr_out_no_serve"
|
|
30
|
-
LPNR_IN_POSITION = "lpnr_in_position"
|
|
31
|
-
LPNR_OUT_POSITION = "lpnr_out_position"
|
|
32
|
-
|
|
33
|
-
LPR_STATE = "lpr_state"
|
|
34
|
-
LPR = "lpr"
|
|
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
|
|
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
|