reach_commons 0.18.5__tar.gz → 0.18.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.18.5 → reach_commons-0.18.7}/PKG-INFO +1 -1
- {reach_commons-0.18.5 → reach_commons-0.18.7}/pyproject.toml +1 -1
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/clients/outscraper.py +3 -2
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/reach_aws/sqs.py +23 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/validations.py +3 -3
- {reach_commons-0.18.5 → reach_commons-0.18.7}/README.md +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/__init__.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/app_logging/__init__.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/app_logging/http_logger.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/app_logging/log_deprecated_endpoints.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/app_logging/logger.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/app_logging/logging_config.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/clients/__init__.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/clients/event_processor.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/clients/hubspot.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/clients/reach_data_bridge.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/clients/reach_ops_api.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/mongo/__init__.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/mongo/customer_persistence.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/mongo/customer_persistence_async.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/mongo/validation/__init__.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/reach_aws/__init__.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/reach_aws/commons.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/reach_aws/dynamo_db.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/reach_aws/exceptions.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/reach_aws/firehose.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/reach_aws/kms.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/reach_aws/s3.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/reach_base_model.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/redis_manager.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/sms_smart_encoding.py +0 -0
- {reach_commons-0.18.5 → reach_commons-0.18.7}/reach_commons/utils.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.18.
|
|
4
|
+
version = "0.18.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"
|
|
@@ -4,9 +4,10 @@ import requests
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class OutscraperClient:
|
|
7
|
-
def __init__(self):
|
|
7
|
+
def __init__(self, token=None):
|
|
8
8
|
self.environment = os.environ.get("ENV", "Staging")
|
|
9
9
|
self.base_url = "https://api.app.outscraper.com"
|
|
10
|
+
self.token = token
|
|
10
11
|
|
|
11
12
|
@property
|
|
12
13
|
def headers(self):
|
|
@@ -20,7 +21,7 @@ class OutscraperClient:
|
|
|
20
21
|
"Prod": "MjZjYWUyMzg4MzUxNDk2Zjk0OGRlOTFlMzkyMDhhYWF8ZDhlNzM5OGVmOQ",
|
|
21
22
|
}.get(self.environment)
|
|
22
23
|
|
|
23
|
-
return {**common_headers, "X-API-KEY": auth_token}
|
|
24
|
+
return {**common_headers, "X-API-KEY": self.token or auth_token}
|
|
24
25
|
|
|
25
26
|
@property
|
|
26
27
|
def webhook_url(self):
|
|
@@ -504,6 +504,15 @@ class POSApiPullerSQSNotifier(SQSClient):
|
|
|
504
504
|
logger=logger,
|
|
505
505
|
topic_name=f"{env}-{self.TOPIC_NAME}",
|
|
506
506
|
)
|
|
507
|
+
self.env = env
|
|
508
|
+
|
|
509
|
+
@cached_property
|
|
510
|
+
def lambda_client(self):
|
|
511
|
+
session = boto3.Session(
|
|
512
|
+
region_name=self.region_name,
|
|
513
|
+
profile_name=self.profile_name,
|
|
514
|
+
)
|
|
515
|
+
return session.client("lambda")
|
|
507
516
|
|
|
508
517
|
def notify_for_send_message(
|
|
509
518
|
self,
|
|
@@ -512,6 +521,20 @@ class POSApiPullerSQSNotifier(SQSClient):
|
|
|
512
521
|
):
|
|
513
522
|
message_attributes = {"service_name": self.SERVICE_NAME}
|
|
514
523
|
|
|
524
|
+
try:
|
|
525
|
+
self.lambda_client.invoke(
|
|
526
|
+
FunctionName=f"{self.env}-nightly-lambda",
|
|
527
|
+
InvocationType="Event",
|
|
528
|
+
Payload=json.dumps(
|
|
529
|
+
{
|
|
530
|
+
"event": "hourly_15",
|
|
531
|
+
"override_status": True,
|
|
532
|
+
}
|
|
533
|
+
).encode("utf-8"),
|
|
534
|
+
)
|
|
535
|
+
except Exception:
|
|
536
|
+
pass
|
|
537
|
+
|
|
515
538
|
return self.publish(
|
|
516
539
|
message_data=message_data,
|
|
517
540
|
message_attributes=message_attributes,
|
|
@@ -5,10 +5,10 @@ from reach_commons.app_logging.logger import get_reach_logger
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class CommonsPhoneNumberValidation:
|
|
8
|
-
def __init__(self, logger=get_reach_logger()):
|
|
8
|
+
def __init__(self, logger=get_reach_logger(), account_sid=None, auth_token=None):
|
|
9
9
|
self.base_url = "https://lookups.twilio.com/v1/PhoneNumbers/"
|
|
10
|
-
self.account_sid = "AC1f9d2cb1c49cf9522f0de29861c9652d"
|
|
11
|
-
self.auth_token = "2a5557dd0c80ea45bc23b3de68455480"
|
|
10
|
+
self.account_sid = account_sid or "AC1f9d2cb1c49cf9522f0de29861c9652d"
|
|
11
|
+
self.auth_token = auth_token or "2a5557dd0c80ea45bc23b3de68455480"
|
|
12
12
|
self.logger = logger
|
|
13
13
|
|
|
14
14
|
def is_valid_phone_number(self, phone_number):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{reach_commons-0.18.5 → reach_commons-0.18.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
|
{reach_commons-0.18.5 → reach_commons-0.18.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
|