Merge branch 'main' into 2401-add-in-flask-socketio-for-api-calls-rather-than-using-ajax

This commit is contained in:
Carlo Costino
2025-04-16 10:55:16 -04:00
27 changed files with 2015 additions and 1757 deletions

View File

@@ -33,7 +33,7 @@ class DocumentDownloadClient:
"document": file_contents,
"is_csv": is_csv or False,
},
timeout=30
timeout=30,
)
response.raise_for_status()

View File

@@ -29,7 +29,7 @@ class PerformancePlatformClient:
self.performance_platform_url + payload["dataType"],
json=payload,
headers=headers,
timeout=30
timeout=30,
)
if resp.status_code == 200:

View File

@@ -48,7 +48,10 @@ class AwsSnsClient(SmsClient):
def send_sms(self, to, content, reference, sender=None, international=False):
matched = False
for match in phonenumbers.PhoneNumberMatcher(to, "US"):
if "+" not in to:
to = f"+{to}"
for match in phonenumbers.PhoneNumberMatcher(to, None):
matched = True
to = phonenumbers.format_number(
match.number, phonenumbers.PhoneNumberFormat.E164

View File

@@ -35,7 +35,7 @@ def cronitor(task_name):
params={
"host": current_app.config["API_HOST_NAME"],
},
timeout=30
timeout=30,
)
resp.raise_for_status()
except requests.RequestException as e:

View File

@@ -105,6 +105,17 @@ def send_sms_to_provider(notification):
# The future home of the validation is TBD
_experimentally_validate_phone_numbers(recipient)
# TODO current we allow US phone numbers to be uploaded without the country code (1)
# This will break certain international phone numbers (Norway, Denmark, East Timor)
# When we officially announce support for international numbers, US numbers must contain
# their country code.
recipient = str(recipient)
if len(recipient) == 10:
if os.getenv("NOTIFY_ENVIRONMENT") not in [
"test"
]: # we want to test intl support
recipient = f"1{recipient}"
sender_numbers = get_sender_numbers(notification)
if notification.reply_to_text not in sender_numbers:
raise ValueError(