atk-common 1.42.0__py3-none-any.whl → 1.44.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 +2 -2
- atk_common/http_response_utils.py +2 -2
- atk_common/http_utils.py +2 -2
- atk_common/internal_response_utils.py +3 -1
- atk_common/log_utils.py +2 -2
- {atk_common-1.42.0.dist-info → atk_common-1.44.0.dist-info}/METADATA +1 -1
- {atk_common-1.42.0.dist-info → atk_common-1.44.0.dist-info}/RECORD +10 -10
- {atk_common-1.42.0.dist-info → atk_common-1.44.0.dist-info}/WHEEL +0 -0
- {atk_common-1.42.0.dist-info → atk_common-1.44.0.dist-info}/licenses/license.txt +0 -0
- {atk_common-1.42.0.dist-info → atk_common-1.44.0.dist-info}/top_level.txt +0 -0
atk_common/error_utils.py
CHANGED
@@ -2,7 +2,7 @@ from http import HTTPStatus
|
|
2
2
|
from flask import Response
|
3
3
|
from enum import Enum
|
4
4
|
import json
|
5
|
-
from atk_common.datetime_utils import
|
5
|
+
from atk_common.datetime_utils import get_utc_date_time_str
|
6
6
|
from atk_common.enums.api_error_type_enum import ApiErrorType
|
7
7
|
from atk_common.http_utils import is_http_status_internal
|
8
8
|
from atk_common.log_utils import add_log_item
|
@@ -33,7 +33,7 @@ def get_error_entity(error, method, error_type, status_code, container_info):
|
|
33
33
|
data['errorType'] = error_type.value if isinstance(error_type, Enum) else error_type
|
34
34
|
data['message'] = get_message(error)
|
35
35
|
data['method'] = method
|
36
|
-
data['timestamp'] =
|
36
|
+
data['timestamp'] = get_utc_date_time_str()
|
37
37
|
data['containerInfo'] = container_info
|
38
38
|
create_error_log(data)
|
39
39
|
return Response(
|
@@ -16,11 +16,11 @@ def http_response(method, response, container_info):
|
|
16
16
|
return Response(
|
17
17
|
response=json.dumps(response['responseMsg']),
|
18
18
|
status=HTTPStatus.OK,
|
19
|
-
mimetype='
|
19
|
+
mimetype=response['contentType'],
|
20
|
+
headers=response['httpHeaders']
|
20
21
|
)
|
21
22
|
if is_http_status_internal(response['statusCode']):
|
22
23
|
if is_response_http(response):
|
23
24
|
resend_error_entity(response['responseMsg'])
|
24
25
|
return get_error_entity(response['responseMsg'], method, ApiErrorType.INTERNAL, response['statusCode'], container_info)
|
25
26
|
return get_error_entity(response['responseMsg'], method, ApiErrorType.CONNECTION, response['statusCode'], container_info)
|
26
|
-
|
atk_common/http_utils.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
from http import HTTPStatus
|
2
|
-
from atk_common.datetime_utils import
|
2
|
+
from atk_common.datetime_utils import get_utc_date_time_str
|
3
3
|
|
4
4
|
def is_http_status_ok(status_code):
|
5
5
|
return status_code >= HTTPStatus.OK.value and status_code < HTTPStatus.MULTIPLE_CHOICES.value
|
@@ -9,7 +9,7 @@ def is_http_status_internal(status_code):
|
|
9
9
|
|
10
10
|
def get_test_response(docker_container_data, component):
|
11
11
|
data = {}
|
12
|
-
data['utcDateTime'] =
|
12
|
+
data['utcDateTime'] = get_utc_date_time_str()
|
13
13
|
if docker_container_data is None:
|
14
14
|
data['containerData'] = None
|
15
15
|
data['component'] = component
|
@@ -1,10 +1,12 @@
|
|
1
1
|
from atk_common.enums.response_status_type_enum import ResponseStatusType
|
2
2
|
|
3
|
-
def create_response(status, status_code, response_msg):
|
3
|
+
def create_response(status, status_code, response_msg, http_headers=None, content_type='application/json'):
|
4
4
|
data = {}
|
5
5
|
data['status'] = status
|
6
6
|
data['statusCode'] = status_code
|
7
7
|
data['responseMsg'] = response_msg
|
8
|
+
data['httpHeaders'] = http_headers
|
9
|
+
data['contentType'] = content_type
|
8
10
|
return data
|
9
11
|
|
10
12
|
def is_response_ok(response):
|
atk_common/log_utils.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
from atk_common.datetime_utils import
|
1
|
+
from atk_common.datetime_utils import get_utc_date_time_str
|
2
2
|
from atk_common.http_utils import is_http_status_internal
|
3
3
|
|
4
4
|
def create_date_time():
|
5
|
-
date_time =
|
5
|
+
date_time = get_utc_date_time_str()
|
6
6
|
return '[' + date_time + '] '
|
7
7
|
|
8
8
|
def add_log_item(text):
|
@@ -3,13 +3,13 @@ atk_common/datetime_utils.py,sha256=JnhMF3IPEqIcWIcXLFrEugFqqQepeXkwGwT-bVmdqWk,
|
|
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=kO-VQlajD8SO9MBxj8MHZRTK_uBXgPa09hy6pfjqZBY,2622
|
7
7
|
atk_common/file_utils.py,sha256=UDwcRquO9IrqRrlUM0t-_g4R1-FKt8ZqQinSEqXOAk8,112
|
8
8
|
atk_common/hash_utils.py,sha256=S_9o89CdI4lUQbVaqc85TDcqyDNuo30_E3VBaOrZKko,1047
|
9
|
-
atk_common/http_response_utils.py,sha256=
|
10
|
-
atk_common/http_utils.py,sha256=
|
11
|
-
atk_common/internal_response_utils.py,sha256=
|
12
|
-
atk_common/log_utils.py,sha256=
|
9
|
+
atk_common/http_response_utils.py,sha256=UId_StkOa1QOlji3i7KYElTn0ynsPLPFZQzPPnB9DYE,1465
|
10
|
+
atk_common/http_utils.py,sha256=Av6wMa9984zQqXSrU3jndxLQO1xwv9U7YDFvJqZQAuo,664
|
11
|
+
atk_common/internal_response_utils.py,sha256=2X9eLFEy1pO3Aesj1IRXg2yprwNcBDM5_dXaA5vfmMI,694
|
12
|
+
atk_common/log_utils.py,sha256=tw6Ph8oTpxrGYe_BcDTYkgrYmFAb1IxTXTodqctAIiY,504
|
13
13
|
atk_common/mq_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
14
|
atk_common/rabbitmq_consumer.py,sha256=4MhuwZs47Jt1fX4sUxr1MKRe7o2QRbPe9_utXEsa8QE,1907
|
15
15
|
atk_common/response_utils.py,sha256=AxlmwkFoDU5XcFOzBQiuZxAQgswihpKXHSo1T0JJw3Q,556
|
@@ -45,7 +45,7 @@ atk_common/enums/sensor_type_enum.py,sha256=UBa3LPyGTKgEJV578CqFlwXjnlXqVlybrvzd
|
|
45
45
|
atk_common/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
|
46
46
|
atk_common/enums/speed_control_status_type_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
|
47
47
|
atk_common/enums/violation_type_enum.py,sha256=01qTHOj-O8bOc-nwIHVnxLosm4cusD_YuqXM3ZsiRRk,86
|
48
|
-
atk_common-1.
|
48
|
+
atk_common-1.44.0.dist-info/licenses/license.txt,sha256=_0O6fWM00-wTurDjnZhUP_N5QiwGhItaQZqHq5eqadA,1063
|
49
49
|
atk_package/__init__.py,sha256=NcsmwFadivgIeWV0-5ACZxqmfo4EzTkJX0r4N6DFAdg,820
|
50
50
|
atk_package/datetime_utils.py,sha256=qsVF7l90P1-xukG2tV_jLqG9J_Yfl5wTpyfrdPBlyMo,239
|
51
51
|
atk_package/env_utils.py,sha256=bXOrxM3fZUslqfmZt75iphbEJHbG4riJa8XOVzPwIII,313
|
@@ -58,7 +58,7 @@ atk_package/enums/__init__.py,sha256=EtUr_--MQj1Rc_R0sF_ELXIThmhpfmhDWq3YaK9oQMk
|
|
58
58
|
atk_package/enums/command_status_enum.py,sha256=M2Nln27a_DbzI07-gfytWQk2X087JhkU6Fmard5qVHs,127
|
59
59
|
atk_package/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
|
60
60
|
shared_python_atk_enforcement/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
61
|
-
atk_common-1.
|
62
|
-
atk_common-1.
|
63
|
-
atk_common-1.
|
64
|
-
atk_common-1.
|
61
|
+
atk_common-1.44.0.dist-info/METADATA,sha256=89hfW8nZQKL8hkkDQi1k6BrNutzFOtOj0NkUM8ivVoM,1464
|
62
|
+
atk_common-1.44.0.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
63
|
+
atk_common-1.44.0.dist-info/top_level.txt,sha256=4CwRjkLnheIdI4jQwc4tK3dbRc58WqUmoqjkdDTWlME,41
|
64
|
+
atk_common-1.44.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|