mirror of
https://github.com/GSA/notifications-api.git
synced 2026-05-01 06:40:02 -04:00
merge from main
This commit is contained in:
@@ -33,6 +33,7 @@ class DocumentDownloadClient:
|
||||
"document": file_contents,
|
||||
"is_csv": is_csv or False,
|
||||
},
|
||||
timeout=30
|
||||
)
|
||||
|
||||
response.raise_for_status()
|
||||
|
||||
@@ -29,6 +29,7 @@ class PerformancePlatformClient:
|
||||
self.performance_platform_url + payload["dataType"],
|
||||
json=payload,
|
||||
headers=headers,
|
||||
timeout=30
|
||||
)
|
||||
|
||||
if resp.status_code == 200:
|
||||
|
||||
@@ -35,6 +35,7 @@ def cronitor(task_name):
|
||||
params={
|
||||
"host": current_app.config["API_HOST_NAME"],
|
||||
},
|
||||
timeout=30
|
||||
)
|
||||
resp.raise_for_status()
|
||||
except requests.RequestException as e:
|
||||
|
||||
@@ -185,8 +185,10 @@ def send_email_to_provider(notification):
|
||||
recipient = recipient.decode("utf-8")
|
||||
personalisation = redis_store.get(f"email-personalisation-{notification.id}")
|
||||
if personalisation:
|
||||
personalisation = personalisation.decode("utf-8")
|
||||
notification.personalisation = json.loads(personalisation)
|
||||
p = personalisation.decode("utf-8")
|
||||
|
||||
p = json.loads(p)
|
||||
notification.personalisation = p
|
||||
|
||||
service = SerialisedService.from_id(notification.service_id)
|
||||
if not service.active:
|
||||
@@ -210,6 +212,12 @@ def send_email_to_provider(notification):
|
||||
template_dict, values=notification.personalisation
|
||||
)
|
||||
|
||||
html_email = str(html_email)
|
||||
html_email = html_email.replace("%5B", "")
|
||||
html_email = html_email.replace("%5D", "")
|
||||
html_email = html_email.replace("(", "")
|
||||
html_email = html_email.replace(")", "")
|
||||
|
||||
if notification.key_type == KeyType.TEST:
|
||||
notification.reference = str(create_uuid())
|
||||
update_notification_to_sending(notification, provider)
|
||||
@@ -225,7 +233,7 @@ def send_email_to_provider(notification):
|
||||
recipient,
|
||||
plain_text_email.subject,
|
||||
body=str(plain_text_email),
|
||||
html_body=str(html_email),
|
||||
html_body=html_email,
|
||||
reply_to_address=notification.reply_to_text,
|
||||
)
|
||||
notification.reference = reference
|
||||
|
||||
@@ -30,7 +30,7 @@ def get_certificate(url):
|
||||
res = redis_store.get(url)
|
||||
if res is not None:
|
||||
return res
|
||||
res = requests.get(url).text
|
||||
res = requests.get(url, timeout=30).text
|
||||
redis_store.set(url, res, ex=60 * 60) # 60 minutes
|
||||
_signing_cert_cache[url] = res
|
||||
return res
|
||||
|
||||
@@ -58,7 +58,7 @@ def sns_notification_handler(data, headers):
|
||||
if "SubscribeUrl" in message
|
||||
else message.get("SubscribeURL")
|
||||
)
|
||||
response = requests.get(url)
|
||||
response = requests.get(url, timeout=30)
|
||||
try:
|
||||
response.raise_for_status()
|
||||
except Exception as e:
|
||||
|
||||
@@ -8,7 +8,7 @@ def confirm_subscription(confirmation_request):
|
||||
current_app.logger.warning("SubscribeURL does not exist or empty")
|
||||
return
|
||||
|
||||
response = requests.get(url)
|
||||
response = requests.get(url, timeout=30)
|
||||
try:
|
||||
response.raise_for_status()
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user