atk-common 1.44.0__py3-none-any.whl → 1.46.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 CHANGED
@@ -10,6 +10,7 @@ from atk_common.http_utils import is_http_status_ok, is_http_status_internal, ge
10
10
  from atk_common.internal_response_utils import create_response, is_response_ok, is_response_http, is_response_internal
11
11
  from atk_common.file_utils import get_image_file_type
12
12
  from atk_common.log_utils import add_log_item, add_log_item_http
13
+ from atk_common.mq_utils import decode_message
13
14
  from atk_common.rabbitmq_consumer import RabbitMQConsumer
14
15
 
15
16
  __all__ = [
@@ -43,6 +44,7 @@ __all__ = [
43
44
  'get_image_file_type',
44
45
  'add_log_item',
45
46
  'add_log_item_http',
47
+ 'decode_message',
46
48
  'RabbitMQConsumer',
47
49
  'get_current_container_info',
48
50
  ]
@@ -12,6 +12,7 @@ from atk_common.enums.history_status_type_enum import HistoryStatusType
12
12
  from atk_common.enums.image_encoding_type_enum import ImageEncodingType
13
13
  from atk_common.enums.image_part_category_enum import ImagePartCategory
14
14
  from atk_common.enums.image_part_type_enum import ImagePartType
15
+ from atk_common.enums.image_shelf_type import ImageShelfType
15
16
  from atk_common.enums.metering_direction_enum import MeteringDirection
16
17
  from atk_common.enums.piezo_vehicle_type_enum import PiezoVehicleType
17
18
  from atk_common.enums.process_status_type_enum import ProcessStatusType
@@ -20,6 +21,7 @@ from atk_common.enums.section_role_enum import SectionRole
20
21
  from atk_common.enums.sensor_order_enum import SensorOrder
21
22
  from atk_common.enums.sensor_type_enum import SensorType
22
23
  from atk_common.enums.speed_control_status_type_enum import SpeedControlStatusType
24
+ from atk_common.enums.test_image_type_enum import TestImageType
23
25
  from atk_common.enums.violation_type_enum import ViolationType
24
26
 
25
27
  __all__ = [
@@ -36,6 +38,7 @@ __all__ = [
36
38
  'ImageEncodingType',
37
39
  'ImagePartCategory',
38
40
  'ImagePartType',
41
+ 'ImageShelfType',
39
42
  'MeteringDirection',
40
43
  'PiezoVehicleType',
41
44
  'ProcessStatusType',
@@ -44,5 +47,6 @@ __all__ = [
44
47
  'SensorOrder',
45
48
  'SensorType',
46
49
  'SpeedControlStatusType',
50
+ 'TestImageType',
47
51
  'ViolationType',
48
52
  ]
@@ -1,13 +1,13 @@
1
1
  from enum import Enum
2
2
 
3
3
  class CommandType(Enum):
4
- POINTENFORCEMENT = 1
5
- SECTIONENFORCEMENT = 2
6
- LOCATIONCONFIG = 3
4
+ POINT_ENFORCEMENT = 1
5
+ SECTION_ENFORCEMENT = 2
6
+ LOCATION_CONFIG = 3
7
7
  PING = 4
8
- CAPTUREIMAGE = 5
9
- GETLASTIMAGE = 6
10
- GETNEXTIMAGE = 7
11
- WRITECAMERAAUX = 8
12
- STOPENFORCEMENTS = 9
13
- RESTARTCAMERA = 10
8
+ CAPTURE_IMAGE = 5
9
+ GETLAST_IMAGE = 6
10
+ GETNEXT_IMAGE = 7
11
+ WRITE_CAMERA_AUX = 8
12
+ STOP_ENFORCEMENTS = 9
13
+ RESTART_CAMERA = 10
@@ -2,4 +2,4 @@ from enum import Enum
2
2
 
3
3
  class EncryptionType(Enum):
4
4
  NONE = 1
5
- X25519AESGCM = 2
5
+ X25519_AES_GCM = 2
@@ -1,5 +1,5 @@
1
1
  from enum import Enum
2
2
 
3
3
  class FileExists(Enum):
4
- FILEEXIST = 1
5
- FILENOTEXIST = 2
4
+ FILE_EXIST = 1
5
+ FILE_NOT_EXIST = 2
@@ -1,6 +1,6 @@
1
1
  from enum import Enum
2
2
 
3
3
  class ImagePartType(Enum):
4
- LICENSEPLATE = 1
4
+ LICENSE_PLATE = 1
5
5
  DRIVER = 2
6
- PHOTOZONE = 3
6
+ PHOTO_ZONE = 3
@@ -0,0 +1,5 @@
1
+ from enum import Enum
2
+
3
+ class ImageShelfType(Enum):
4
+ TOP = 1
5
+ BOTTOM = 2
@@ -1,5 +1,5 @@
1
1
  from enum import Enum
2
2
 
3
3
  class MeteringDirection(Enum):
4
- WITHMETERING = 1
5
- AGAINSTMETERING = 2
4
+ WITH_METERING = 1
5
+ AGAINST_METERING = 2
@@ -5,4 +5,4 @@ class ProcessStatusType(Enum):
5
5
  STARTED = 2
6
6
  FINALIZED = 3
7
7
  LOCKED = 4
8
- NOTAPPROVED = 5
8
+ NOT_APPROVED = 5
@@ -0,0 +1,7 @@
1
+ from enum import Enum
2
+
3
+ class TestImageType(Enum):
4
+ CAPTURE_IMAGE = 1
5
+ GETLAST_IMAGE = 2
6
+ GETNEXT_IMAGE = 3
7
+ EXAMPLE = 4
@@ -21,6 +21,6 @@ def http_response(method, response, container_info):
21
21
  )
22
22
  if is_http_status_internal(response['statusCode']):
23
23
  if is_response_http(response):
24
- resend_error_entity(response['responseMsg'])
24
+ return resend_error_entity(response['responseMsg'])
25
25
  return get_error_entity(response['responseMsg'], method, ApiErrorType.INTERNAL, response['statusCode'], container_info)
26
26
  return get_error_entity(response['responseMsg'], method, ApiErrorType.CONNECTION, response['statusCode'], container_info)
atk_common/mq_utils.py CHANGED
@@ -0,0 +1,25 @@
1
+ import json
2
+ from atk_common.error_utils import get_message
3
+ from atk_common.log_utils import add_log_item
4
+
5
+ def decode_message(body, message):
6
+ import gzip
7
+ import msgpack
8
+ try:
9
+ content_encoding = message.headers.get('content_encoding')
10
+ if content_encoding is not None and content_encoding == 'gzip':
11
+ body = gzip.decompress(body)
12
+ if message.content_type == 'application/json':
13
+ return body
14
+ elif message.content_type == 'application/octet-stream':
15
+ return body
16
+ elif message.content_type == 'application/x-msgpack' or message.content_type == 'application/msgpack':
17
+ return msgpack.unpackb(body, raw=False)
18
+ elif message.content_type.startswith('text/'):
19
+ return body.decode('utf-8')
20
+ else:
21
+ add_log_item('Unknown message content type')
22
+ return None
23
+ except Exception as error:
24
+ add_log_item('Error decoding message: ' + get_message(error))
25
+ return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atk_common
3
- Version: 1.44.0
3
+ Version: 1.46.0
4
4
  Summary: ATK common methods
5
5
  Home-page: https://github.com/pypa/atk_common
6
6
  Author: Roger
@@ -1,4 +1,4 @@
1
- atk_common/__init__.py,sha256=iSBLmDzJX8JxGpJyP4G_ZdtQG0d41JNAjzKTac7YAXk,1907
1
+ atk_common/__init__.py,sha256=d_2XoFaQx5CGiBqbTdA3hx-yZ-CAXd-xXYk1DNBAXMg,1978
2
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
@@ -6,36 +6,37 @@ atk_common/env_utils.py,sha256=66v-S0vlkJNaun6ay1XcOGRtYJb4Ce4odJsWxuaHsQc,373
6
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=UId_StkOa1QOlji3i7KYElTn0ynsPLPFZQzPPnB9DYE,1465
9
+ atk_common/http_response_utils.py,sha256=7Fw81OVMp6HCvsdtPgvlMywL1srSCVNSvqcBZGTkYpE,1472
10
10
  atk_common/http_utils.py,sha256=Av6wMa9984zQqXSrU3jndxLQO1xwv9U7YDFvJqZQAuo,664
11
11
  atk_common/internal_response_utils.py,sha256=2X9eLFEy1pO3Aesj1IRXg2yprwNcBDM5_dXaA5vfmMI,694
12
12
  atk_common/log_utils.py,sha256=tw6Ph8oTpxrGYe_BcDTYkgrYmFAb1IxTXTodqctAIiY,504
13
- atk_common/mq_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ atk_common/mq_utils.py,sha256=gMu41yUTZk1Ujxcc2OikrjefShIQPJD_j1d8zM6pGgs,1032
14
14
  atk_common/rabbitmq_consumer.py,sha256=4MhuwZs47Jt1fX4sUxr1MKRe7o2QRbPe9_utXEsa8QE,1907
15
15
  atk_common/response_utils.py,sha256=AxlmwkFoDU5XcFOzBQiuZxAQgswihpKXHSo1T0JJw3Q,556
16
- atk_common/enums/__init__.py,sha256=hejNKl04AfatJ2ovXXu72psSzBYQYC3f8SlqOT2g5GI,2058
16
+ atk_common/enums/__init__.py,sha256=i3HO5i7AEjUo74Qdr2nHpG1SGb5Okl15CVG9nMMqVG0,2230
17
17
  atk_common/enums/api_error_type_enum.py,sha256=9oW6ZaZ3lhMwR8r2sVNWGliS9C_jV-otiOYdezAuTp0,91
18
18
  atk_common/enums/camera_cabinet_type_enum.py,sha256=U2NVrsTCBgaMRwYJamnjshAW8Y7xlOVjvUzakdgVH9A,90
19
19
  atk_common/enums/camera_role_enum.py,sha256=E0TH6zXj5EA889D7UndGP7xsgg5W23SneqJCFkA6BII,82
20
20
  atk_common/enums/certificate_issuer_enum.py,sha256=Gsuzn-EQF2LYgkaNZQYb5j5rfMNPdmmF2np5n-ztYrg,98
21
21
  atk_common/enums/command_status_enum.py,sha256=M2Nln27a_DbzI07-gfytWQk2X087JhkU6Fmard5qVHs,127
22
22
  atk_common/enums/command_status_type_enum.py,sha256=M2Nln27a_DbzI07-gfytWQk2X087JhkU6Fmard5qVHs,127
23
- atk_common/enums/command_type_enum.py,sha256=boAtZMIrikFb1E3_dNV8IjJ4v18xcFr7qk1R4rTNhi0,284
23
+ atk_common/enums/command_type_enum.py,sha256=9dlYyrKA6FVjTG4UTAVbEDxMCwsoD_SCZP3144VgckE,294
24
24
  atk_common/enums/detection_status_enum.py,sha256=852t9-LaQAzcTELtHtiGPfgwhX58q4uWMvgzq2Spyzs,84
25
25
  atk_common/enums/detection_status_type_enum.py,sha256=oHmoOP2zhcWQBBchj7CwECf99EdT8QSY6T8l5n8Kvcg,88
26
- atk_common/enums/encryption_type_enum.py,sha256=jlrKeH2-Iakkuby8pwq8uXhX8A2FTvdULe633edGOc4,91
27
- atk_common/enums/file_exists_enum.py,sha256=5qAl-bHzFwArxE5sVRFsteyg6eCsgi-SVrO72A_hzpY,92
26
+ atk_common/enums/encryption_type_enum.py,sha256=vy_1B-lUYZTyBvqAC5bOfhB3bPr5g9K8s5rjfsnm_AE,93
27
+ atk_common/enums/file_exists_enum.py,sha256=SUmzyczBCRaa9XWjqdFRsg4OczdF0_Z4NX77Ev4vzOo,95
28
28
  atk_common/enums/history_status_type_enum.py,sha256=itxQEQL8zQhkCR-fzKk3PcMDN1YcrbrcDlLcNCQDNHs,152
29
29
  atk_common/enums/http_status_enum.py,sha256=bJSTmkLxHnb04fWSDKuhTWrh_v9iCQM7otAVr731JDk,139
30
30
  atk_common/enums/image_encoding_type_enum.py,sha256=s32PjcrprGUf7MG4UQNE3ssH-y9RiLtbwtNwKQxWMvE,98
31
31
  atk_common/enums/image_part_category.py,sha256=YQ7xtO8v7Ja77Tu-Wo_wewLOULtalPtDsmHvEEWsnsw,87
32
32
  atk_common/enums/image_part_category_enum.py,sha256=YQ7xtO8v7Ja77Tu-Wo_wewLOULtalPtDsmHvEEWsnsw,87
33
33
  atk_common/enums/image_part_type.py,sha256=tg6W9kYMRShOlsxhAJRNRdWH50gC-eF0sqvqsponP-M,111
34
- atk_common/enums/image_part_type_enum.py,sha256=tg6W9kYMRShOlsxhAJRNRdWH50gC-eF0sqvqsponP-M,111
35
- atk_common/enums/metering_direction_enum.py,sha256=HKRNy4DPI10F7XJs6eyYw4CBhiFp8SzWE4jSdGoRwnk,105
34
+ atk_common/enums/image_part_type_enum.py,sha256=NREEtLNMVVFo-RiOWR_krUSZWRscWMCo2PHHTnZnmLg,113
35
+ atk_common/enums/image_shelf_type.py,sha256=m2-nWi83tWi-KYpTMphyt-yhK5iGNvHrJBNYjodx1P4,84
36
+ atk_common/enums/metering_direction_enum.py,sha256=ramBPt0fK_NsToCqiYmtzDVNsLVGbeF39TmSpn_ghTY,107
36
37
  atk_common/enums/piezo_vehicle_type_enum.py,sha256=tlFk9dP7KkJVBna8SIJf6MH9zJD_szSUcDxFATJ6LZE,89
37
38
  atk_common/enums/process_status_enum.py,sha256=09kRE5Cy8Sc7e7wf5gSkIw0RnNzFAWxIrMvn-aElqt8,140
38
- atk_common/enums/process_status_type_enum.py,sha256=eihCfOTTWvmS1hEp_wYzl0PqIPawuUcrlWgyhbyKd48,144
39
+ atk_common/enums/process_status_type_enum.py,sha256=FHtg8Hrf0sAHNGCWiEFTo1hKGBGp6Wb6oyZvFbeL23U,145
39
40
  atk_common/enums/response_status_enum.py,sha256=ogYXlGm0gJJDGlY6Fwq9Kvl861aGPop2qzfXXExzMKw,99
40
41
  atk_common/enums/response_status_type_enum.py,sha256=LjGttBOMwbf5JB-DTXbKCIC7BU8nntP0mW-c8GTeu90,103
41
42
  atk_common/enums/section_role_enum.py,sha256=9rwep4Wmvyvnlrey08TRRoi8VQYAPkylpP00uafIQMg,74
@@ -44,8 +45,9 @@ atk_common/enums/sensor_order_enum.py,sha256=TQtLlvjyc8-CnhmA6-iHLhreQziPoBlgFV_
44
45
  atk_common/enums/sensor_type_enum.py,sha256=UBa3LPyGTKgEJV578CqFlwXjnlXqVlybrvzdjsHhjSU,80
45
46
  atk_common/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
46
47
  atk_common/enums/speed_control_status_type_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
48
+ atk_common/enums/test_image_type_enum.py,sha256=HUjxJorehnzRXMNF2uHk2DrAJ3Y_ajQvp0jW-mtlOhU,140
47
49
  atk_common/enums/violation_type_enum.py,sha256=01qTHOj-O8bOc-nwIHVnxLosm4cusD_YuqXM3ZsiRRk,86
48
- atk_common-1.44.0.dist-info/licenses/license.txt,sha256=_0O6fWM00-wTurDjnZhUP_N5QiwGhItaQZqHq5eqadA,1063
50
+ atk_common-1.46.0.dist-info/licenses/license.txt,sha256=_0O6fWM00-wTurDjnZhUP_N5QiwGhItaQZqHq5eqadA,1063
49
51
  atk_package/__init__.py,sha256=NcsmwFadivgIeWV0-5ACZxqmfo4EzTkJX0r4N6DFAdg,820
50
52
  atk_package/datetime_utils.py,sha256=qsVF7l90P1-xukG2tV_jLqG9J_Yfl5wTpyfrdPBlyMo,239
51
53
  atk_package/env_utils.py,sha256=bXOrxM3fZUslqfmZt75iphbEJHbG4riJa8XOVzPwIII,313
@@ -58,7 +60,7 @@ atk_package/enums/__init__.py,sha256=EtUr_--MQj1Rc_R0sF_ELXIThmhpfmhDWq3YaK9oQMk
58
60
  atk_package/enums/command_status_enum.py,sha256=M2Nln27a_DbzI07-gfytWQk2X087JhkU6Fmard5qVHs,127
59
61
  atk_package/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
60
62
  shared_python_atk_enforcement/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
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,,
63
+ atk_common-1.46.0.dist-info/METADATA,sha256=OXmN4i1RvhlZi5X_6rcbA-Xt9i0HxFwTipIzfvJ5yps,1464
64
+ atk_common-1.46.0.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
65
+ atk_common-1.46.0.dist-info/top_level.txt,sha256=4CwRjkLnheIdI4jQwc4tK3dbRc58WqUmoqjkdDTWlME,41
66
+ atk_common-1.46.0.dist-info/RECORD,,