atk-common 3.0.0__py3-none-any.whl → 3.2.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.
@@ -1,7 +1,7 @@
1
1
  import json
2
2
  from typing import Optional
3
3
  from opentelemetry.trace import get_current_span
4
- from atk_common.interfaces import ILogger # for type hints only
4
+ from atk_common.interfaces import ILogger
5
5
  from atk_common.enums import LogLevel
6
6
  from atk_common.utils.datetime_utils import get_utc_date_time_str
7
7
  from atk_common.enums.log_level_enum import LogLevel
@@ -4,7 +4,7 @@ from atk_common.interfaces import IEnvHandler
4
4
  from atk_common.interfaces import ILogger
5
5
 
6
6
  class EnvHandler(IEnvHandler):
7
- def __init__(self, logger: Optional(ILogger)): # type: ignore
7
+ def __init__(self, logger: Optional[ILogger]): # type: ignore
8
8
  self.logger = logger
9
9
 
10
10
  def val_str(self, value):
@@ -1,5 +1,5 @@
1
1
  from kombu import Producer
2
- from atk_common.classes.bo_logger import BoLogger
2
+ from atk_common.interfaces import ILogger
3
3
  from atk_common.utils.internal_response_utils import is_response_ok
4
4
 
5
5
  """
@@ -11,7 +11,7 @@ should_retry: function(message_status) -> bool
11
11
  bo_logger: BoLogger instance for logging
12
12
  declare: optional kombu.DeclarativeExchange or Queue to declare before publishing
13
13
  """
14
- def create_retry_handler(process_func, connection, exchange, routing_key, should_retry, bo_logger: BoLogger, declare=None):
14
+ def create_retry_handler(process_func, connection, exchange, routing_key, should_retry, logger: ILogger, declare=None):
15
15
 
16
16
  def handler(body, message):
17
17
  try:
@@ -22,7 +22,7 @@ def create_retry_handler(process_func, connection, exchange, routing_key, should
22
22
  if connection is not None:
23
23
  # Use retry queue
24
24
  if should_retry(process_response):
25
- bo_logger.info("Retrying after delay...")
25
+ logger.info("Retrying after delay...")
26
26
  with connection.Producer() as producer:
27
27
  producer.publish(
28
28
  message.body,
@@ -37,19 +37,19 @@ def create_retry_handler(process_func, connection, exchange, routing_key, should
37
37
  )
38
38
  message.ack()
39
39
  else:
40
- bo_logger.critical("Sending to DLQ...")
40
+ logger.critical("Sending to DLQ...")
41
41
  message.reject(requeue=False)
42
42
  else:
43
43
  if should_retry(process_response):
44
- bo_logger.critical("Sending to DLQ...")
44
+ logger.critical("Sending to DLQ...")
45
45
  message.reject(requeue=False)
46
46
  # bo_logger.critical("Requing...")
47
47
  # message.requeue()
48
48
  else:
49
- bo_logger.critical("Discarding message...")
49
+ logger.critical("Discarding message...")
50
50
  message.ack()
51
51
  except Exception as e:
52
- bo_logger.critical(f"Error during processing: {e}, sending to DLQ...")
52
+ logger.critical(f"Error during processing: {e}, sending to DLQ...")
53
53
  message.reject(requeue=False)
54
54
 
55
55
  return handler
@@ -1,11 +1,11 @@
1
1
  import json
2
2
  from http import HTTPStatus
3
- from atk_common.classes.bo_logger import BoLogger
3
+ from atk_common.interfaces import ILogger
4
4
  from atk_common.enums.response_status_type_enum import ResponseStatusType
5
5
  from atk_common.utils.error_utils import get_message
6
6
  from atk_common.utils.internal_response_utils import create_response
7
7
 
8
- def decode_message(body, message, bo_logger: BoLogger):
8
+ def decode_message(body, message, logger: ILogger):
9
9
  import gzip
10
10
  import msgpack
11
11
  try:
@@ -23,8 +23,8 @@ def decode_message(body, message, bo_logger: BoLogger):
23
23
  elif message.content_type.startswith('text/'):
24
24
  return create_response(ResponseStatusType.OK, HTTPStatus.OK, body.decode('utf-8'))
25
25
  else:
26
- bo_logger.critical(f"Unknown message content type {message.content_type}. Cannot decode message.")
26
+ logger.critical(f"Unknown message content type {message.content_type}. Cannot decode message.")
27
27
  return create_response(ResponseStatusType.INTERNAL, HTTPStatus.INTERNAL_SERVER_ERROR, get_message(error))
28
28
  except Exception as error:
29
- bo_logger.critical('Error decoding message: ' + get_message(error))
29
+ logger.critical('Error decoding message: ' + get_message(error))
30
30
  return create_response(ResponseStatusType.INTERNAL, HTTPStatus.INTERNAL_SERVER_ERROR, get_message(error))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atk_common
3
- Version: 3.0.0
3
+ Version: 3.2.0
4
4
  Summary: ATK common methods
5
5
  Home-page: https://github.com/pypa/atk_common
6
6
  Author: Roger
@@ -17,9 +17,9 @@ atk_common/mq_utils.py,sha256=6z4l7LsZWCzldsCZPsWnCtN4lIQ3gyoSuywQoQOh5Ak,1137
17
17
  atk_common/rabbitmq_consumer.py,sha256=4MhuwZs47Jt1fX4sUxr1MKRe7o2QRbPe9_utXEsa8QE,1907
18
18
  atk_common/response_utils.py,sha256=AxlmwkFoDU5XcFOzBQiuZxAQgswihpKXHSo1T0JJw3Q,556
19
19
  atk_common/classes/__init__.py,sha256=O_VHYxAilmoz3i9L6jkwS-JZ4UaTezdhFiA5liNl1lY,532
20
- atk_common/classes/bo_logger.py,sha256=DKEVtdm_ikMT3fbEEyWS3zsWvKn86Cckby2lTBm1mkM,2088
20
+ atk_common/classes/bo_logger.py,sha256=TvSAeECElnrKmkbvuksxNO9XcqQ64DmX3WftA6iVp3M,2065
21
21
  atk_common/classes/docker_handler.py,sha256=73WiebIT_RwGgwyvIed_Q5p8Tsb1b22JChBDyUmf1IU,2949
22
- atk_common/classes/env_handler.py,sha256=sFx5dNiZZVOfIdvahOiDUG5LdHLIz4gAqGQGz2dqVgo,1286
22
+ atk_common/classes/env_handler.py,sha256=XbBPGJZ0n3q5coStHAbmbLnAVqOrFuFcs5JtIdJxUd8,1286
23
23
  atk_common/classes/error_handler.py,sha256=PrQ3njxYrqVCJzwdS2cSyshNktT_AHFMMRaC9vKtjyg,3257
24
24
  atk_common/classes/http_response_handler.py,sha256=B83UW-W6pE5BcUaoYcIb1RS-TzZEeZ22vgWmvB7xT30,2176
25
25
  atk_common/classes/rabbitmq_consumer.py,sha256=aPMF5H50k__a1HEy8GGwNdhSqu-wjbw2L3TESyd1cEg,2941
@@ -70,7 +70,7 @@ atk_common/interfaces/error_handler_interface.py,sha256=H43hSeeThT_7EbNzh-rygAJW
70
70
  atk_common/interfaces/http_response_handler_interface.py,sha256=QjDmhVj4AnUyoRtSHk_sfFPI-cto6TV7Mx2_87tiOrs,185
71
71
  atk_common/interfaces/logger_interface.py,sha256=w9bhheJFCQ76qpoO_o0N-F6KVKf4HaHOKLRx_c7Jgsk,315
72
72
  atk_common/utils/__init__.py,sha256=HPqGmoNy6y1Bgu3Um_o1g0R5DnS-UZv1_ueC4i0uP30,1708
73
- atk_common/utils/consumer_retry_handler.py,sha256=TxlcX7JzU7XBXxGrpWHyisrpouItU0cLisVgTwO0boc,2601
73
+ atk_common/utils/consumer_retry_handler.py,sha256=DvKXDnpkOmVqIfghWnOGMcnI430c39BCJyXSVbIFerE,2574
74
74
  atk_common/utils/datetime_utils.py,sha256=0SC5-Nai4RJH9B0VzvGKUQts_QeRXGb7tJLlsh73LJw,3556
75
75
  atk_common/utils/db_utils.py,sha256=odUtXcS7Mumw5eGyVyVimL_U_lP7TqMX9v8nWO5nMvg,902
76
76
  atk_common/utils/default_should_retry.py,sha256=qghFbU71ygC8ARc0jkbDlxwZtwEPUqO8vGhIhGJX-Ao,838
@@ -79,8 +79,8 @@ atk_common/utils/file_utils.py,sha256=UDwcRquO9IrqRrlUM0t-_g4R1-FKt8ZqQinSEqXOAk
79
79
  atk_common/utils/hash_utils.py,sha256=S_9o89CdI4lUQbVaqc85TDcqyDNuo30_E3VBaOrZKko,1047
80
80
  atk_common/utils/http_utils.py,sha256=eSRuQeDgN0ISQdByZqE6cIGXoorcAXz7PEtVntHUKAo,670
81
81
  atk_common/utils/internal_response_utils.py,sha256=2X9eLFEy1pO3Aesj1IRXg2yprwNcBDM5_dXaA5vfmMI,694
82
- atk_common/utils/mq_utils.py,sha256=W4EVbM9FMPEwk7QJGksTqPN_of3yL1kBIhWpQNi6v_I,1859
83
- atk_common-3.0.0.dist-info/licenses/license.txt,sha256=_0O6fWM00-wTurDjnZhUP_N5QiwGhItaQZqHq5eqadA,1063
82
+ atk_common/utils/mq_utils.py,sha256=jd3TUzqtS-wHu_Gu7LsrTRjqfEyGCn639nCzV_vzC7s,1841
83
+ atk_common-3.2.0.dist-info/licenses/license.txt,sha256=_0O6fWM00-wTurDjnZhUP_N5QiwGhItaQZqHq5eqadA,1063
84
84
  atk_package/__init__.py,sha256=okIFEefQhQrw6DZg6oCEVWsEdkVCk-57VXBW0IUG_wU,834
85
85
  atk_package/datetime_utils.py,sha256=qsVF7l90P1-xukG2tV_jLqG9J_Yfl5wTpyfrdPBlyMo,239
86
86
  atk_package/env_utils.py,sha256=bXOrxM3fZUslqfmZt75iphbEJHbG4riJa8XOVzPwIII,313
@@ -93,7 +93,7 @@ atk_package/enums/__init__.py,sha256=EtUr_--MQj1Rc_R0sF_ELXIThmhpfmhDWq3YaK9oQMk
93
93
  atk_package/enums/command_status_enum.py,sha256=M2Nln27a_DbzI07-gfytWQk2X087JhkU6Fmard5qVHs,127
94
94
  atk_package/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
95
95
  shared_python_atk_enforcement/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
96
- atk_common-3.0.0.dist-info/METADATA,sha256=axS2RZluWJzOwXZT_YcnbIez7lAmxGLaXjEvVmaE-80,1760
97
- atk_common-3.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
98
- atk_common-3.0.0.dist-info/top_level.txt,sha256=4CwRjkLnheIdI4jQwc4tK3dbRc58WqUmoqjkdDTWlME,41
99
- atk_common-3.0.0.dist-info/RECORD,,
96
+ atk_common-3.2.0.dist-info/METADATA,sha256=-VP2tolBWHw3W4kMuiIxn_oKXApY3x5V3g26NdAlqvA,1760
97
+ atk_common-3.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
98
+ atk_common-3.2.0.dist-info/top_level.txt,sha256=4CwRjkLnheIdI4jQwc4tK3dbRc58WqUmoqjkdDTWlME,41
99
+ atk_common-3.2.0.dist-info/RECORD,,