reach_commons 0.15.5__tar.gz → 0.15.7__tar.gz
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.
- {reach_commons-0.15.5 → reach_commons-0.15.7}/PKG-INFO +1 -1
- {reach_commons-0.15.5 → reach_commons-0.15.7}/pyproject.toml +1 -1
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/reach_aws/sqs.py +31 -0
- reach_commons-0.15.7/reach_commons/sms_smart_encoding.py +40 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/README.md +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/__init__.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/app_logging/__init__.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/app_logging/http_logger.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/app_logging/log_deprecated_endpoints.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/app_logging/logger.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/app_logging/logging_config.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/clients/__init__.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/clients/event_processor.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/clients/hubspot.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/clients/outscraper.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/clients/reach_data_bridge.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/clients/reach_ops_api.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/mongo/__init__.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/mongo/customer_persistence.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/mongo/customer_persistence_async.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/mongo/validation/__init__.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/reach_aws/__init__.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/reach_aws/commons.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/reach_aws/dynamo_db.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/reach_aws/exceptions.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/reach_aws/firehose.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/reach_aws/kms.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/reach_aws/s3.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/reach_base_model.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/redis_manager.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/utils.py +0 -0
- {reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/validations.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# isort .; black .; poetry build; poetry publish
|
|
2
2
|
[tool.poetry]
|
|
3
3
|
name = "reach_commons"
|
|
4
|
-
version = "0.15.
|
|
4
|
+
version = "0.15.7"
|
|
5
5
|
description = "Reach Commons is a versatile utility library designed to streamline and enhance development workflows within the Reach ecosystem."
|
|
6
6
|
authors = ["Wilson Moraes <wmoraes@getreach.ai>"]
|
|
7
7
|
license = "MIT"
|
|
@@ -472,3 +472,34 @@ class SmsProcessorSQSNotifier(SQSClient):
|
|
|
472
472
|
message_attributes=message_attributes,
|
|
473
473
|
delay_seconds=delay_seconds,
|
|
474
474
|
)
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
class POSApiPullerSQSNotifier(SQSClient):
|
|
478
|
+
SERVICE_NAME = "POSApiPullerSQSNotifier"
|
|
479
|
+
TOPIC_NAME = "pos-api-messages-queue"
|
|
480
|
+
DEFAULT_REGION = "us-east-1"
|
|
481
|
+
|
|
482
|
+
def __init__(
|
|
483
|
+
self,
|
|
484
|
+
region_name=DEFAULT_REGION,
|
|
485
|
+
logger=get_reach_logger(),
|
|
486
|
+
env=os.environ.get("ENV", "Staging"),
|
|
487
|
+
):
|
|
488
|
+
super().__init__(
|
|
489
|
+
region_name=region_name,
|
|
490
|
+
logger=logger,
|
|
491
|
+
topic_name=f"{env}-{self.TOPIC_NAME}",
|
|
492
|
+
)
|
|
493
|
+
|
|
494
|
+
def notify_for_send_message(
|
|
495
|
+
self,
|
|
496
|
+
message_data: dict,
|
|
497
|
+
delay_seconds=2,
|
|
498
|
+
):
|
|
499
|
+
message_attributes = {"service_name": self.SERVICE_NAME}
|
|
500
|
+
|
|
501
|
+
return self.publish(
|
|
502
|
+
message_data=message_data,
|
|
503
|
+
message_attributes=message_attributes,
|
|
504
|
+
delay_seconds=delay_seconds,
|
|
505
|
+
)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
|
+
from math import ceil
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@dataclass
|
|
6
|
+
class MessageSmartEncoding:
|
|
7
|
+
"""
|
|
8
|
+
Sms Message Representation
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
replacements = {
|
|
12
|
+
"“": '"',
|
|
13
|
+
"”": '"',
|
|
14
|
+
"‘": "'",
|
|
15
|
+
"’": "'",
|
|
16
|
+
"–": "-",
|
|
17
|
+
"—": "-",
|
|
18
|
+
"…": "...",
|
|
19
|
+
"•": "-",
|
|
20
|
+
"€": "EUR",
|
|
21
|
+
"™": "",
|
|
22
|
+
"©": "",
|
|
23
|
+
"®": "",
|
|
24
|
+
"\u0002": "",
|
|
25
|
+
"\u001b": "",
|
|
26
|
+
}
|
|
27
|
+
body: str
|
|
28
|
+
normalized_text: str = field(init=False)
|
|
29
|
+
length: int = field(init=False)
|
|
30
|
+
segments: int = field(init=False)
|
|
31
|
+
|
|
32
|
+
def __post_init__(self):
|
|
33
|
+
self.normalized_text = self.normalize(self.body)
|
|
34
|
+
self.length = len(self.normalized_text)
|
|
35
|
+
self.segments = ceil(self.length / 160)
|
|
36
|
+
|
|
37
|
+
def normalize(self, text: str) -> str:
|
|
38
|
+
for char, replacement in self.replacements.items():
|
|
39
|
+
text = text.replace(char, replacement)
|
|
40
|
+
return text
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/app_logging/log_deprecated_endpoints.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{reach_commons-0.15.5 → reach_commons-0.15.7}/reach_commons/mongo/customer_persistence_async.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|