mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 01:41:05 -05:00
some cleanup
This commit is contained in:
@@ -96,7 +96,6 @@ def cleanup_old_s3_objects():
|
|||||||
time_limit = aware_utcnow() - datetime.timedelta(days=14)
|
time_limit = aware_utcnow() - datetime.timedelta(days=14)
|
||||||
try:
|
try:
|
||||||
response = s3_client.list_objects_v2(Bucket=bucket_name)
|
response = s3_client.list_objects_v2(Bucket=bucket_name)
|
||||||
print(f"RESPONSE = {response}")
|
|
||||||
while True:
|
while True:
|
||||||
for obj in response.get("Contents", []):
|
for obj in response.get("Contents", []):
|
||||||
if obj["LastModified"] <= time_limit:
|
if obj["LastModified"] <= time_limit:
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ class AwsPinpointClient(Client):
|
|||||||
# but remove this when that changes
|
# but remove this when that changes
|
||||||
current_app.logger.info(hilite(response))
|
current_app.logger.info(hilite(response))
|
||||||
except ClientError:
|
except ClientError:
|
||||||
current_app.logger.exception("Could not validate with pinpoint")
|
current_app.logger.exception(
|
||||||
|
"#validate-phone-number Could not validate with pinpoint"
|
||||||
|
)
|
||||||
|
|
||||||
# TODO This is the structure of the response. When the phone validation
|
# TODO This is the structure of the response. When the phone validation
|
||||||
# capability we want to offer is better defined (it may just be a question
|
# capability we want to offer is better defined (it may just be a question
|
||||||
|
|||||||
@@ -100,8 +100,15 @@ def send_sms_to_provider(notification):
|
|||||||
|
|
||||||
# TODO This is temporary to test the capability of validating phone numbers
|
# TODO This is temporary to test the capability of validating phone numbers
|
||||||
# The future home of the validation is TBD
|
# The future home of the validation is TBD
|
||||||
if recipient in current_app.config["SIMULATED_SMS_NUMBERS"]:
|
if "+" not in recipient:
|
||||||
|
recipient_lookup = f"+{recipient}"
|
||||||
|
else:
|
||||||
|
recipient_lookup = recipient
|
||||||
|
if recipient_lookup in current_app.config["SIMULATED_SMS_NUMBERS"]:
|
||||||
|
current_app.logger.info(hilite("#validate-phone-number fired"))
|
||||||
aws_pinpoint_client.validate_phone_number("01", recipient)
|
aws_pinpoint_client.validate_phone_number("01", recipient)
|
||||||
|
else:
|
||||||
|
current_app.logger.info(hilite("#validate-phone-number not fired"))
|
||||||
|
|
||||||
sender_numbers = get_sender_numbers(notification)
|
sender_numbers = get_sender_numbers(notification)
|
||||||
if notification.reply_to_text not in sender_numbers:
|
if notification.reply_to_text not in sender_numbers:
|
||||||
|
|||||||
Reference in New Issue
Block a user