internal 1.1.11__py3-none-any.whl → 1.1.12__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.

Potentially problematic release.


This version of internal might be problematic. Click here for more details.

internal/base_factory.py CHANGED
@@ -19,7 +19,7 @@ from .const import LOG_FMT, LOG_FMT_NO_DT, LOG_DT_FMT, DEFAULT_LOGGER_NAME, CORR
19
19
  from .exception.base_exception import InternalBaseException
20
20
  from .exception.internal_exception import BadGatewayException, GatewayTimeoutException
21
21
  from .ext.amazon import aws
22
- from .http.requests import async_request
22
+ from .http.requests import send_webhook_message
23
23
  from .http.responses import async_response
24
24
  from .middleware.log_request import LogRequestMiddleware
25
25
  from .utils import update_dict_with_cast
@@ -157,19 +157,11 @@ class BaseFactory(metaclass=ABCMeta):
157
157
  if isinstance(exc, BadGatewayException):
158
158
  if self.get_app_config().WEBHOOK_BASE_URL:
159
159
  message = f"【{self.DEFAULT_APP_NAME}】Bad gateway, request:{request.__dict__}, exc:{exc}"
160
- payload = {"text": message}
161
- try:
162
- await async_request(app, "POST", self.get_app_config().WEBHOOK_BASE_URL, json=payload)
163
- except Exception as e:
164
- app.state.logger.warn(f"Notify failure, Exception:{e}")
160
+ await send_webhook_message(app, message)
165
161
  elif isinstance(exc, GatewayTimeoutException):
166
162
  if self.get_app_config().WEBHOOK_BASE_URL:
167
163
  message = f"【{self.DEFAULT_APP_NAME}】Gateway timeout, request:{request.__dict__}, exc:{exc}"
168
- payload = {"text": message}
169
- try:
170
- await async_request(app, "POST", self.get_app_config().WEBHOOK_BASE_URL, json=payload)
171
- except Exception as e:
172
- app.state.logger.warn(f"Notify failure, Exception:{e}")
164
+ await send_webhook_message(app, message)
173
165
 
174
166
  return await async_response(data=detail.get("data"), code=detail.get("code"), message=detail.get("message"),
175
167
  status_code=exc.status_code)
@@ -187,13 +179,8 @@ class BaseFactory(metaclass=ABCMeta):
187
179
  async def http_exception_handler(request: Request, exc: Exception):
188
180
  app.state.logger.warn(f"Exception, request:{request.__dict__}, exc:{exc}")
189
181
  app.state.logger.warn(traceback.format_exc())
190
- if self.get_app_config().WEBHOOK_BASE_URL:
191
- message = f"【{self.DEFAULT_APP_NAME}】Unprocessed Exception, request:{request.__dict__}, exc:{exc}"
192
- payload = {"text": message}
193
- try:
194
- await async_request(app, "POST", self.get_app_config().WEBHOOK_BASE_URL, json=payload)
195
- except Exception as e:
196
- app.state.logger.warn(f"Notify failure, Exception:{e}")
182
+ message = f"【{self.DEFAULT_APP_NAME}】Unprocessed Exception, request:{request.__dict__}, exc:{exc}"
183
+ await send_webhook_message(app, message)
197
184
 
198
185
  return await async_response(code="error_internal_server", message="Internal server error",
199
186
  status_code=status.HTTP_500_INTERNAL_SERVER_ERROR)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: internal
3
- Version: 1.1.11
3
+ Version: 1.1.12
4
4
  Summary:
5
5
  Author: Ray
6
6
  Author-email: ray@cruisys.com
@@ -1,6 +1,6 @@
1
1
  internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  internal/base_config.py,sha256=gbzgQklOzdQUY63b5k15dgk1sxVyYR4OcWXP0RHVNTI,2280
3
- internal/base_factory.py,sha256=DVWjOeCOURscykpm0MizOvT9PjbclpoVv92XySWMDkw,11353
3
+ internal/base_factory.py,sha256=PUhPehpdB8wAUUm0QhbfzzIMeIL87ko8peIromoumnQ,10575
4
4
  internal/cache_redis.py,sha256=YMsrUXHd-wKjsjsboD79Y-ciBBowzT6aAjdJZ36-yEY,697
5
5
  internal/common_enum/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  internal/common_enum/contact_type.py,sha256=7QkTQ71UxpaT1YHI40FpjmLz3r-UbRU-sd0m5ajH1as,142
@@ -34,6 +34,6 @@ internal/model/base_model.py,sha256=hxleV8fYNvFgUoYmCv_inEP3kA4tD4HhCBCNFVK8SZg,
34
34
  internal/model/operate.py,sha256=QSM6yXYXpJMwrqkUGEWZLrEBaUgqHwVHY_Fi4S42hKc,3190
35
35
  internal/utils.py,sha256=i6YZdiXsiWnOjRdlJ6afNCGpyMe3Uo9mhm3xlQBy3Ls,2824
36
36
  internal/validator_utils.py,sha256=CqjaVFoAu5MqvBG_AkTP-r7AliWawtUWB851USj4moI,1519
37
- internal-1.1.11.dist-info/METADATA,sha256=62bJWUCU0Ty1dBYZ96QHuYpE8EzSQAqVgzsoOL76Mgk,939
38
- internal-1.1.11.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
39
- internal-1.1.11.dist-info/RECORD,,
37
+ internal-1.1.12.dist-info/METADATA,sha256=F0VpGummXYYHUr1L5Hdc2TlI75Grti0PmKSMS7luE18,939
38
+ internal-1.1.12.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
39
+ internal-1.1.12.dist-info/RECORD,,