internal 0.1.96__tar.gz → 0.1.97__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-0.1.96 → internal-0.1.97}/PKG-INFO +1 -1
- {internal-0.1.96 → internal-0.1.97}/pyproject.toml +1 -1
- {internal-0.1.96 → internal-0.1.97}/src/internal/base_config.py +5 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/base_factory.py +9 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/common_enum/service_ticket_event_trigger_type.py +2 -0
- {internal-0.1.96 → internal-0.1.97}/README.md +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/__init__.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/common_enum/__init__.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/common_enum/contact_type.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/common_enum/event_type.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/common_enum/operator_type.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/const.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/database.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/exception/__init__.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/exception/base_exception.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/exception/internal_exception.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/ext/__init__.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/ext/amazon/__init__.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/ext/amazon/aws/__init__.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/ext/amazon/aws/const.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/http/__init__.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/http/requests.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/http/responses.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/interface/__init__.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/interface/base_interface.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/model/__init__.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/model/base_model.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/model/operate.py +0 -0
- {internal-0.1.96 → internal-0.1.97}/src/internal/utils.py +0 -0
|
@@ -47,5 +47,10 @@ class BaseConfig(BaseSettings):
|
|
|
47
47
|
THIRD_PARTY_BASE_URL: str = "http://third-party-service-api:5000"
|
|
48
48
|
SCHEDULER_BASE_URL: str = "http://scheduler-service-api:5000"
|
|
49
49
|
|
|
50
|
+
# Exception Notify
|
|
51
|
+
SLACK_WEBHOOK_BASE_URL: str = ""
|
|
52
|
+
SLACK_WEBHOOK_CHANNEL: str = ""
|
|
53
|
+
SLACK_WEBHOOK_USERNAME: str = ""
|
|
54
|
+
|
|
50
55
|
class Config:
|
|
51
56
|
case_sensitive = False
|
|
@@ -16,6 +16,7 @@ from . import database
|
|
|
16
16
|
from .const import LOG_FMT, LOG_FMT_NO_DT, LOG_DT_FMT, DEFAULT_LOGGER_NAME
|
|
17
17
|
from .exception.base_exception import InternalBaseException
|
|
18
18
|
from .ext.amazon import aws
|
|
19
|
+
from .http.requests import async_request
|
|
19
20
|
from .http.responses import async_response
|
|
20
21
|
from .utils import update_dict_with_cast
|
|
21
22
|
|
|
@@ -111,6 +112,14 @@ class BaseFactory(metaclass=ABCMeta):
|
|
|
111
112
|
async def http_exception_handler(request: Request, exc: Exception):
|
|
112
113
|
app.state.logger.warn(f"Exception, request:{request.__dict__}, exc:{exc}")
|
|
113
114
|
app.state.logger.warn(traceback.format_exc())
|
|
115
|
+
if self.get_app_config().SLACK_WEBHOOK_BASE_URL and self.get_app_config().SLACK_WEBHOOK_CHANNEL and self.get_app_config().SLACK_WEBHOOK_USERNAME:
|
|
116
|
+
message = f"【{self.DEFAULT_APP_NAME}】Unprocessed Exception, request:{request.__dict__}, exc:{exc}"
|
|
117
|
+
payload = {"channel": f"#{self.get_app_config().SLACK_WEBHOOK_CHANNEL}", "username": self.get_app_config().SLACK_WEBHOOK_USERNAME, "text": message}
|
|
118
|
+
try:
|
|
119
|
+
await async_request(app, "POST", self.get_app_config().SLACK_WEBHOOK_BASE_URL, json=payload)
|
|
120
|
+
except Exception as e:
|
|
121
|
+
app.state.logger.warn(f"Notify failure, Exception:{e}")
|
|
122
|
+
|
|
114
123
|
return await async_response(code="error_internal_server", message="Internal server error",
|
|
115
124
|
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR)
|
|
116
125
|
|
{internal-0.1.96 → internal-0.1.97}/src/internal/common_enum/service_ticket_event_trigger_type.py
RENAMED
|
@@ -9,4 +9,6 @@ class ServiceTicketEventTriggerTypeEnum(str, Enum):
|
|
|
9
9
|
MANUAL_CREATE_SMWS = "manual_create_smws"
|
|
10
10
|
MANUAL_IMPORT_RESERVATION_SMWS = "manual_import_reservation_smws"
|
|
11
11
|
IMPORT_RESERVATION_CONFLICT_AUTO_CANCEL = "import_reservation_conflict_auto_cancel"
|
|
12
|
+
LPNR_IN = "lpnr_in"
|
|
13
|
+
LPNR_OUT = "lpnr_out"
|
|
12
14
|
|
|
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
|