atk-common 1.38.0__py3-none-any.whl → 1.39.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/error_utils.py +0 -1
- atk_common/http_utils.py +0 -24
- {atk_common-1.38.0.dist-info → atk_common-1.39.0.dist-info}/METADATA +1 -1
- {atk_common-1.38.0.dist-info → atk_common-1.39.0.dist-info}/RECORD +7 -7
- {atk_common-1.38.0.dist-info → atk_common-1.39.0.dist-info}/WHEEL +0 -0
- {atk_common-1.38.0.dist-info → atk_common-1.39.0.dist-info}/licenses/license.txt +0 -0
- {atk_common-1.38.0.dist-info → atk_common-1.39.0.dist-info}/top_level.txt +0 -0
atk_common/error_utils.py
CHANGED
atk_common/http_utils.py
CHANGED
@@ -1,10 +1,5 @@
|
|
1
|
-
from flask import Response
|
2
|
-
import json
|
3
1
|
from http import HTTPStatus
|
4
2
|
from atk_common.datetime_utils import get_utc_date_time
|
5
|
-
from atk_common.enums.api_error_type_enum import ApiErrorType
|
6
|
-
from atk_common.error_utils import get_error_entity, resend_error_entity
|
7
|
-
from atk_common.internal_response_utils import is_response_http
|
8
3
|
|
9
4
|
def is_http_status_ok(status_code):
|
10
5
|
return status_code >= HTTPStatus.OK.value and status_code < HTTPStatus.MULTIPLE_CHOICES.value
|
@@ -21,22 +16,3 @@ def get_test_response(docker_container_data, component):
|
|
21
16
|
else:
|
22
17
|
data['containerData'] = docker_container_data
|
23
18
|
return data
|
24
|
-
|
25
|
-
# If response['status'] == 0 (OK, http status = 200): create Response and return response['responseMsg']
|
26
|
-
# If http status == 500:
|
27
|
-
# If response['status'] == 1 (HTTP): resend received error entity
|
28
|
-
# If response['status'] == 2 (INTERNAL): create new error entity and return as response
|
29
|
-
# If http status other value: create new error entity and return as response
|
30
|
-
def create_http_response(method, response, container_info):
|
31
|
-
if is_http_status_ok(response['statusCode']):
|
32
|
-
return Response(
|
33
|
-
response=json.dumps(response['responseMsg']),
|
34
|
-
status=HTTPStatus.OK,
|
35
|
-
mimetype='application/json'
|
36
|
-
)
|
37
|
-
if is_http_status_internal(response['statusCode']):
|
38
|
-
if is_response_http(response):
|
39
|
-
resend_error_entity(response['responseMsg'])
|
40
|
-
return get_error_entity(response['responseMsg'], method, ApiErrorType.INTERNAL, response['statusCode'], container_info)
|
41
|
-
return get_error_entity(response['responseMsg'], method, ApiErrorType.CONNECTION, response['statusCode'], container_info)
|
42
|
-
|
@@ -3,10 +3,10 @@ atk_common/datetime_utils.py,sha256=3OIzPCt7W3vA4HvjnlfV0KJjRAjXuTaJ_QOa-cCMNns,
|
|
3
3
|
atk_common/db_utils.py,sha256=odUtXcS7Mumw5eGyVyVimL_U_lP7TqMX9v8nWO5nMvg,902
|
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=gY_YYRkwgC-rwVBvdv3A4MWmDWKkCKZeev9fEMq4_Tw,2614
|
7
7
|
atk_common/file_utils.py,sha256=UDwcRquO9IrqRrlUM0t-_g4R1-FKt8ZqQinSEqXOAk8,112
|
8
8
|
atk_common/http_response_utils.py,sha256=Zvm52yHAAxooRA_op6HR23t3qxuilqbrLOHERoLIhoU,1423
|
9
|
-
atk_common/http_utils.py,sha256=
|
9
|
+
atk_common/http_utils.py,sha256=M1Qz2Cus3Ek8nUOqraT-30GKSj7nkAvJx2f7rnpX5Pk,656
|
10
10
|
atk_common/internal_response_utils.py,sha256=nEbNxv4y03Qzhs1yRn--RnCfPrT7-ThlmqarAAQJtbw,562
|
11
11
|
atk_common/log_utils.py,sha256=k7VaknmSGvHQV6-eznltNUa3BOAywjFHkhVzDT1P0Hs,496
|
12
12
|
atk_common/mq_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -44,7 +44,7 @@ atk_common/enums/sensor_type_enum.py,sha256=UBa3LPyGTKgEJV578CqFlwXjnlXqVlybrvzd
|
|
44
44
|
atk_common/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
|
45
45
|
atk_common/enums/speed_control_status_type_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
|
46
46
|
atk_common/enums/violation_type_enum.py,sha256=01qTHOj-O8bOc-nwIHVnxLosm4cusD_YuqXM3ZsiRRk,86
|
47
|
-
atk_common-1.
|
47
|
+
atk_common-1.39.0.dist-info/licenses/license.txt,sha256=_0O6fWM00-wTurDjnZhUP_N5QiwGhItaQZqHq5eqadA,1063
|
48
48
|
atk_package/__init__.py,sha256=NcsmwFadivgIeWV0-5ACZxqmfo4EzTkJX0r4N6DFAdg,820
|
49
49
|
atk_package/datetime_utils.py,sha256=qsVF7l90P1-xukG2tV_jLqG9J_Yfl5wTpyfrdPBlyMo,239
|
50
50
|
atk_package/env_utils.py,sha256=bXOrxM3fZUslqfmZt75iphbEJHbG4riJa8XOVzPwIII,313
|
@@ -57,7 +57,7 @@ atk_package/enums/__init__.py,sha256=EtUr_--MQj1Rc_R0sF_ELXIThmhpfmhDWq3YaK9oQMk
|
|
57
57
|
atk_package/enums/command_status_enum.py,sha256=M2Nln27a_DbzI07-gfytWQk2X087JhkU6Fmard5qVHs,127
|
58
58
|
atk_package/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
|
59
59
|
shared_python_atk_enforcement/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
60
|
-
atk_common-1.
|
61
|
-
atk_common-1.
|
62
|
-
atk_common-1.
|
63
|
-
atk_common-1.
|
60
|
+
atk_common-1.39.0.dist-info/METADATA,sha256=MRGVPrn9ztLrloWPs9Q9MwIA4_3T_E0p46x0fYWfy3I,1464
|
61
|
+
atk_common-1.39.0.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
62
|
+
atk_common-1.39.0.dist-info/top_level.txt,sha256=4CwRjkLnheIdI4jQwc4tK3dbRc58WqUmoqjkdDTWlME,41
|
63
|
+
atk_common-1.39.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|