atk-common 1.40.0__py3-none-any.whl → 1.42.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/__init__.py +6 -3
- atk_common/datetime_utils.py +3 -0
- atk_common/hash_utils.py +21 -0
- atk_common/http_response_utils.py +1 -1
- {atk_common-1.40.0.dist-info → atk_common-1.42.0.dist-info}/METADATA +1 -1
- {atk_common-1.40.0.dist-info → atk_common-1.42.0.dist-info}/RECORD +9 -8
- {atk_common-1.40.0.dist-info → atk_common-1.42.0.dist-info}/WHEEL +0 -0
- {atk_common-1.40.0.dist-info → atk_common-1.42.0.dist-info}/licenses/license.txt +0 -0
- {atk_common-1.40.0.dist-info → atk_common-1.42.0.dist-info}/top_level.txt +0 -0
atk_common/__init__.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# __init__.py
|
2
|
-
from atk_common.datetime_utils import get_utc_date_time, seconds_to_utc_timestamp, get_utc_date_from_iso, adjust_millisescond, convert_to_utc
|
2
|
+
from atk_common.datetime_utils import get_utc_date_time, get_utc_date_time_str, seconds_to_utc_timestamp, get_utc_date_from_iso, adjust_millisescond, convert_to_utc
|
3
3
|
from atk_common.db_utils import sql, sql_with_record, convert_none_to_null, date_time_utc_column
|
4
4
|
from atk_common.docker_utils import get_current_container_info
|
5
5
|
from atk_common.env_utils import get_env_value
|
6
6
|
from atk_common.error_utils import get_message, create_error_log, get_error_entity, resend_error_entity, handle_error, get_response_error, get_error_type
|
7
|
-
|
7
|
+
from atk_common.http_response_utils import http_response
|
8
|
+
from atk_common.hash_utils import create_enforcement_hash
|
8
9
|
from atk_common.http_utils import is_http_status_ok, is_http_status_internal, get_test_response
|
9
10
|
from atk_common.internal_response_utils import create_response, is_response_ok, is_response_http, is_response_internal
|
10
11
|
from atk_common.file_utils import get_image_file_type
|
@@ -13,6 +14,7 @@ from atk_common.rabbitmq_consumer import RabbitMQConsumer
|
|
13
14
|
|
14
15
|
__all__ = [
|
15
16
|
'get_utc_date_time',
|
17
|
+
'get_utc_date_time_str',
|
16
18
|
'seconds_to_utc_timestamp',
|
17
19
|
'get_utc_date_from_iso',
|
18
20
|
'adjust_millisescond',
|
@@ -29,7 +31,8 @@ __all__ = [
|
|
29
31
|
'handle_error',
|
30
32
|
'get_response_error',
|
31
33
|
'get_error_type',
|
32
|
-
|
34
|
+
'create_enforcement_hash',
|
35
|
+
'http_response',
|
33
36
|
'is_http_status_ok',
|
34
37
|
'is_http_status_internal',
|
35
38
|
'get_test_response',
|
atk_common/datetime_utils.py
CHANGED
atk_common/hash_utils.py
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
import hashlib
|
2
|
+
import json
|
3
|
+
|
4
|
+
def create_enforcement_hash(request_json, created_on):
|
5
|
+
data = {}
|
6
|
+
data['commandTypeId'] = request_json['commandTypeId']
|
7
|
+
data['controlGroupId'] = request_json['controlGroupId']
|
8
|
+
data['controlSiteId'] = request_json['controlSiteId']
|
9
|
+
data['numberOfImages'] = request_json['numberOfImages']
|
10
|
+
data['startDatetime'] = request_json['startDatetime']
|
11
|
+
data['stopDatetime'] = request_json['stopDatetime']
|
12
|
+
data['speedLimit'] = request_json['speedLimit']
|
13
|
+
data['photoLimit'] = request_json['photoLimit']
|
14
|
+
data['heavyVehicleSpeedLimit'] = request_json['heavyVehicleSpeedLimit']
|
15
|
+
data['heavyVehiclePhotoLimit'] = request_json['heavyVehiclePhotoLimit']
|
16
|
+
data['testSeries'] = request_json['testSeries']
|
17
|
+
data['comment'] = request_json['comment']
|
18
|
+
data['commandCreatedBy'] = request_json['commandCreatedBy']
|
19
|
+
data['commandCreatedOn'] = created_on
|
20
|
+
json_to_hash = json.dumps(data, sort_keys = True).encode("utf-8")
|
21
|
+
return hashlib.md5(json_to_hash).hexdigest()
|
@@ -11,7 +11,7 @@ from atk_common.internal_response_utils import is_response_http
|
|
11
11
|
# If response['status'] == 1 (HTTP): resend received error entity
|
12
12
|
# If response['status'] == 2 (INTERNAL): create new error entity and return as response
|
13
13
|
# If http status other value: create new error entity and return as response
|
14
|
-
def
|
14
|
+
def http_response(method, response, container_info):
|
15
15
|
if is_http_status_ok(response['statusCode']):
|
16
16
|
return Response(
|
17
17
|
response=json.dumps(response['responseMsg']),
|
@@ -1,11 +1,12 @@
|
|
1
|
-
atk_common/__init__.py,sha256=
|
2
|
-
atk_common/datetime_utils.py,sha256=
|
1
|
+
atk_common/__init__.py,sha256=iSBLmDzJX8JxGpJyP4G_ZdtQG0d41JNAjzKTac7YAXk,1907
|
2
|
+
atk_common/datetime_utils.py,sha256=JnhMF3IPEqIcWIcXLFrEugFqqQepeXkwGwT-bVmdqWk,2115
|
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
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
|
-
atk_common/
|
8
|
+
atk_common/hash_utils.py,sha256=S_9o89CdI4lUQbVaqc85TDcqyDNuo30_E3VBaOrZKko,1047
|
9
|
+
atk_common/http_response_utils.py,sha256=a6DyA3QW8LSlVv_BvP-CgaXT3I-VOOxm8CCu4yUNORc,1416
|
9
10
|
atk_common/http_utils.py,sha256=M1Qz2Cus3Ek8nUOqraT-30GKSj7nkAvJx2f7rnpX5Pk,656
|
10
11
|
atk_common/internal_response_utils.py,sha256=nEbNxv4y03Qzhs1yRn--RnCfPrT7-ThlmqarAAQJtbw,562
|
11
12
|
atk_common/log_utils.py,sha256=k7VaknmSGvHQV6-eznltNUa3BOAywjFHkhVzDT1P0Hs,496
|
@@ -44,7 +45,7 @@ atk_common/enums/sensor_type_enum.py,sha256=UBa3LPyGTKgEJV578CqFlwXjnlXqVlybrvzd
|
|
44
45
|
atk_common/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
|
45
46
|
atk_common/enums/speed_control_status_type_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
|
46
47
|
atk_common/enums/violation_type_enum.py,sha256=01qTHOj-O8bOc-nwIHVnxLosm4cusD_YuqXM3ZsiRRk,86
|
47
|
-
atk_common-1.
|
48
|
+
atk_common-1.42.0.dist-info/licenses/license.txt,sha256=_0O6fWM00-wTurDjnZhUP_N5QiwGhItaQZqHq5eqadA,1063
|
48
49
|
atk_package/__init__.py,sha256=NcsmwFadivgIeWV0-5ACZxqmfo4EzTkJX0r4N6DFAdg,820
|
49
50
|
atk_package/datetime_utils.py,sha256=qsVF7l90P1-xukG2tV_jLqG9J_Yfl5wTpyfrdPBlyMo,239
|
50
51
|
atk_package/env_utils.py,sha256=bXOrxM3fZUslqfmZt75iphbEJHbG4riJa8XOVzPwIII,313
|
@@ -57,7 +58,7 @@ atk_package/enums/__init__.py,sha256=EtUr_--MQj1Rc_R0sF_ELXIThmhpfmhDWq3YaK9oQMk
|
|
57
58
|
atk_package/enums/command_status_enum.py,sha256=M2Nln27a_DbzI07-gfytWQk2X087JhkU6Fmard5qVHs,127
|
58
59
|
atk_package/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
|
59
60
|
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.
|
61
|
+
atk_common-1.42.0.dist-info/METADATA,sha256=zr7sF8D-eY3Gv4l5RUEYvaNsTdRF4dzq5Le6W1rK0bA,1464
|
62
|
+
atk_common-1.42.0.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
63
|
+
atk_common-1.42.0.dist-info/top_level.txt,sha256=4CwRjkLnheIdI4jQwc4tK3dbRc58WqUmoqjkdDTWlME,41
|
64
|
+
atk_common-1.42.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|