atk-common 1.18.0__py3-none-any.whl → 1.20.0__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.
- atk_common/enums/__init__.py +20 -4
- atk_common/enums/encryption_type_enum.py +5 -0
- atk_common/enums/image_encoding_type_enum.py +6 -0
- atk_common/enums/image_part_category.py +5 -0
- atk_common/enums/image_part_type.py +6 -0
- atk_common/enums/process_status_enum.py +8 -0
- atk_common/enums/section_role_enum.py +5 -0
- atk_common/enums/sensor_type_enum.py +5 -0
- atk_common/enums/violation_type_enum.py +5 -0
- atk_common/error_utils.py +9 -9
- {atk_common-1.18.0.dist-info → atk_common-1.20.0.dist-info}/METADATA +1 -1
- {atk_common-1.18.0.dist-info → atk_common-1.20.0.dist-info}/RECORD +15 -7
- {atk_common-1.18.0.dist-info → atk_common-1.20.0.dist-info}/WHEEL +0 -0
- {atk_common-1.18.0.dist-info → atk_common-1.20.0.dist-info}/licenses/license.txt +0 -0
- {atk_common-1.18.0.dist-info → atk_common-1.20.0.dist-info}/top_level.txt +0 -0
atk_common/enums/__init__.py
CHANGED
@@ -1,12 +1,28 @@
|
|
1
1
|
# __init__.py
|
2
|
-
from atk_common.enums.command_status_enum import CommandStatusType
|
3
|
-
from atk_common.enums.speed_control_status_enum import SpeedControlStatusType
|
4
2
|
from atk_common.enums.api_error_type_enum import ApiErrorType
|
3
|
+
from atk_common.enums.command_status_enum import CommandStatusType
|
4
|
+
from atk_common.enums.encryption_type_enum import EncryptionType
|
5
|
+
from atk_common.enums.image_encoding_type_enum import ImageEncodingType
|
6
|
+
from atk_common.enums.image_part_category import ImagePartCategory
|
7
|
+
from atk_common.enums.image_part_type import ImagePartType
|
8
|
+
from atk_common.enums.process_status_enum import ProcessStatus
|
5
9
|
from atk_common.enums.response_status_enum import ResponseStatus
|
10
|
+
from atk_common.enums.section_role_enum import SectionRole
|
11
|
+
from atk_common.enums.sensor_type_enum import SensorType
|
12
|
+
from atk_common.enums.speed_control_status_enum import SpeedControlStatusType
|
13
|
+
from atk_common.enums.violation_type_enum import ViolationType
|
6
14
|
|
7
15
|
__all__ = [
|
8
|
-
'CommandStatusType',
|
9
|
-
'SpeedControlStatusType',
|
10
16
|
'ApiErrorType',
|
17
|
+
'CommandStatusType',
|
18
|
+
'EncryptionType',
|
19
|
+
'ImageEncodingType',
|
20
|
+
'ImagePartCategory',
|
21
|
+
'ImagePartType',
|
22
|
+
'ProcessStatus',
|
11
23
|
'ResponseStatus',
|
24
|
+
'SectionRole',
|
25
|
+
'SensorType',
|
26
|
+
'SpeedControlStatusType',
|
27
|
+
'ViolationType',
|
12
28
|
]
|
atk_common/error_utils.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
from http import HTTPStatus
|
2
|
+
from flask import Response
|
2
3
|
from datetime import datetime
|
4
|
+
from enum import Enum
|
3
5
|
import json
|
4
6
|
from atk_common.datetime_utils import get_utc_date_time
|
5
7
|
from atk_common.enums.api_error_type_enum import ApiErrorType
|
@@ -25,23 +27,21 @@ def create_error_log(data):
|
|
25
27
|
err_str += ', containerName: <none>'
|
26
28
|
add_log_item(err_str)
|
27
29
|
|
28
|
-
def get_error_entity(
|
30
|
+
def get_error_entity(error, method, error_type, status_code, container_info):
|
29
31
|
data = {}
|
30
32
|
data['statusCode'] = status_code
|
31
33
|
data['exceptionType'] = str(type(error))
|
32
|
-
data['errorType'] = error_type
|
34
|
+
data['errorType'] = error_type.value if isinstance(error_type, Enum) else error_type
|
33
35
|
data['message'] = get_message(error)
|
34
36
|
data['method'] = method
|
35
37
|
data['timestamp'] = get_utc_date_time()
|
36
38
|
data['containerInfo'] = container_info
|
37
39
|
create_error_log(data)
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
)
|
44
|
-
return None
|
40
|
+
return Response(
|
41
|
+
response=json.dumps(data),
|
42
|
+
status=HTTPStatus.INTERNAL_SERVER_ERROR,
|
43
|
+
mimetype='application/json'
|
44
|
+
)
|
45
45
|
|
46
46
|
def handle_error(resp, status):
|
47
47
|
if is_http_status_internal(resp.status_code):
|
@@ -3,19 +3,27 @@ atk_common/datetime_utils.py,sha256=qsVF7l90P1-xukG2tV_jLqG9J_Yfl5wTpyfrdPBlyMo,
|
|
3
3
|
atk_common/db_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
atk_common/docker_utils.py,sha256=nkUhp2OhwJsm41JDujHDY-JxQfdDjy91duprH59Esfk,2084
|
5
5
|
atk_common/env_utils.py,sha256=66v-S0vlkJNaun6ay1XcOGRtYJb4Ce4odJsWxuaHsQc,373
|
6
|
-
atk_common/error_utils.py,sha256=
|
6
|
+
atk_common/error_utils.py,sha256=7SN-Jz3i2MGIPqsexnjgbZg5poMnALLEiCJQ4za5im4,2398
|
7
7
|
atk_common/http_utils.py,sha256=M1Qz2Cus3Ek8nUOqraT-30GKSj7nkAvJx2f7rnpX5Pk,656
|
8
8
|
atk_common/log_utils.py,sha256=k7VaknmSGvHQV6-eznltNUa3BOAywjFHkhVzDT1P0Hs,496
|
9
9
|
atk_common/mq_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
atk_common/rabbitmq_consumer.py,sha256=4MhuwZs47Jt1fX4sUxr1MKRe7o2QRbPe9_utXEsa8QE,1907
|
11
11
|
atk_common/response_utils.py,sha256=jlCm3a7GKolV6zR1emIEGmMH93V6yktiv-lgNa3TNEw,349
|
12
|
-
atk_common/enums/__init__.py,sha256=
|
12
|
+
atk_common/enums/__init__.py,sha256=aeL5BH72S7BDSLULlu6KxoplHCTZqPQQWKLvRq8r1YE,1103
|
13
13
|
atk_common/enums/api_error_type_enum.py,sha256=9oW6ZaZ3lhMwR8r2sVNWGliS9C_jV-otiOYdezAuTp0,91
|
14
14
|
atk_common/enums/command_status_enum.py,sha256=M2Nln27a_DbzI07-gfytWQk2X087JhkU6Fmard5qVHs,127
|
15
|
+
atk_common/enums/encryption_type_enum.py,sha256=jlrKeH2-Iakkuby8pwq8uXhX8A2FTvdULe633edGOc4,91
|
15
16
|
atk_common/enums/http_status_enum.py,sha256=bJSTmkLxHnb04fWSDKuhTWrh_v9iCQM7otAVr731JDk,139
|
17
|
+
atk_common/enums/image_encoding_type_enum.py,sha256=s32PjcrprGUf7MG4UQNE3ssH-y9RiLtbwtNwKQxWMvE,98
|
18
|
+
atk_common/enums/image_part_category.py,sha256=YQ7xtO8v7Ja77Tu-Wo_wewLOULtalPtDsmHvEEWsnsw,87
|
19
|
+
atk_common/enums/image_part_type.py,sha256=tg6W9kYMRShOlsxhAJRNRdWH50gC-eF0sqvqsponP-M,111
|
20
|
+
atk_common/enums/process_status_enum.py,sha256=09kRE5Cy8Sc7e7wf5gSkIw0RnNzFAWxIrMvn-aElqt8,140
|
16
21
|
atk_common/enums/response_status_enum.py,sha256=ogYXlGm0gJJDGlY6Fwq9Kvl861aGPop2qzfXXExzMKw,99
|
22
|
+
atk_common/enums/section_role_enum.py,sha256=9rwep4Wmvyvnlrey08TRRoi8VQYAPkylpP00uafIQMg,74
|
23
|
+
atk_common/enums/sensor_type_enum.py,sha256=UBa3LPyGTKgEJV578CqFlwXjnlXqVlybrvzdjsHhjSU,80
|
17
24
|
atk_common/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
|
18
|
-
atk_common
|
25
|
+
atk_common/enums/violation_type_enum.py,sha256=01qTHOj-O8bOc-nwIHVnxLosm4cusD_YuqXM3ZsiRRk,86
|
26
|
+
atk_common-1.20.0.dist-info/licenses/license.txt,sha256=_0O6fWM00-wTurDjnZhUP_N5QiwGhItaQZqHq5eqadA,1063
|
19
27
|
atk_package/__init__.py,sha256=EceDa352WFHTdC_LxYANXf_TS9pGzK3MCx87bwAKTvg,811
|
20
28
|
atk_package/datetime_utils.py,sha256=qsVF7l90P1-xukG2tV_jLqG9J_Yfl5wTpyfrdPBlyMo,239
|
21
29
|
atk_package/env_utils.py,sha256=bXOrxM3fZUslqfmZt75iphbEJHbG4riJa8XOVzPwIII,313
|
@@ -28,7 +36,7 @@ atk_package/enums/__init__.py,sha256=oW0aVnwewfH6sNu14jjZ5_uP4iRN4pRmGdTNC204rHo
|
|
28
36
|
atk_package/enums/command_status_enum.py,sha256=M2Nln27a_DbzI07-gfytWQk2X087JhkU6Fmard5qVHs,127
|
29
37
|
atk_package/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
|
30
38
|
shared_python_atk_enforcement/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
|
-
atk_common-1.
|
32
|
-
atk_common-1.
|
33
|
-
atk_common-1.
|
34
|
-
atk_common-1.
|
39
|
+
atk_common-1.20.0.dist-info/METADATA,sha256=tGgmjgTI8pwI6wAhOupxVqT12rZp6CAF-5gkYRk1BoI,1464
|
40
|
+
atk_common-1.20.0.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
41
|
+
atk_common-1.20.0.dist-info/top_level.txt,sha256=4CwRjkLnheIdI4jQwc4tK3dbRc58WqUmoqjkdDTWlME,41
|
42
|
+
atk_common-1.20.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|