mirror of
https://github.com/GSA/notifications-api.git
synced 2026-07-12 09:24:27 -04:00
Add more debug
This commit is contained in:
@@ -138,15 +138,12 @@ def extract_personalisation(job):
|
||||
print(hilite(f"first_row again: {first_row}"))
|
||||
personalisation = {}
|
||||
job_row = 0
|
||||
|
||||
row_csv_module = csv.reader(job)
|
||||
for row_module in row_csv_module:
|
||||
print(hilite(f"CSV MODULE ROW: {row_module}"))
|
||||
|
||||
for row in job:
|
||||
row = row.split(",")
|
||||
for row in row_csv_module:
|
||||
print(hilite(f"row: {row}"))
|
||||
temp = dict(zip(first_row, row))
|
||||
print(hilite(f"temp: {temp}"))
|
||||
personalisation[job_row] = temp
|
||||
job_row = job_row + 1
|
||||
print(hilite(f"job_row: {job_row}"))
|
||||
|
||||
@@ -18,7 +18,7 @@ from app.dao.notifications_dao import (
|
||||
from app.delivery import send_to_providers
|
||||
from app.enums import NotificationStatus
|
||||
from app.exceptions import NotificationTechnicalFailureException
|
||||
from app.utils import utc_now
|
||||
from app.utils import hilite, utc_now
|
||||
|
||||
# This is the amount of time to wait after sending an sms message before we check the aws logs and look for delivery
|
||||
# receipts
|
||||
@@ -100,7 +100,7 @@ def deliver_sms(self, notification_id):
|
||||
notification = notifications_dao.get_notification_by_id(notification_id)
|
||||
ansi_green = "\033[32m"
|
||||
ansi_reset = "\033[0m"
|
||||
|
||||
print(hilite(f"notification inside of deliver_sms: {notification}"))
|
||||
if not notification:
|
||||
raise NoResultFound()
|
||||
if (
|
||||
|
||||
@@ -170,6 +170,7 @@ def __total_sending_limits_for_job_exceeded(service, job, job_id):
|
||||
def save_sms(self, service_id, notification_id, encrypted_notification, sender_id=None):
|
||||
"""Persist notification to db and place notification in queue to send to sns."""
|
||||
notification = encryption.decrypt(encrypted_notification)
|
||||
print(hilite(f"notification at the top of save_sms: {notification}"))
|
||||
# SerialisedService and SerialisedTemplate classes are
|
||||
# used here to grab the same service and template from the cache
|
||||
# to improve performance.
|
||||
|
||||
@@ -2,6 +2,7 @@ import os
|
||||
import re
|
||||
from time import monotonic
|
||||
|
||||
from app.utils import hilite
|
||||
import botocore
|
||||
import phonenumbers
|
||||
from boto3 import client
|
||||
@@ -54,7 +55,7 @@ class AwsSnsClient(SmsClient):
|
||||
to = phonenumbers.format_number(
|
||||
match.number, phonenumbers.PhoneNumberFormat.E164
|
||||
)
|
||||
|
||||
print(hilite(f"to in send_sms: {to}"))
|
||||
# See documentation
|
||||
# https://docs.aws.amazon.com/sns/latest/dg/sms_publish-to-phone.html#sms_publish_sdk
|
||||
attributes = {
|
||||
|
||||
@@ -86,6 +86,7 @@ def send_sms_to_provider(notification):
|
||||
notification.job_id,
|
||||
notification.job_row_number,
|
||||
)
|
||||
print(hilite(f"recipient: {recipient}"))
|
||||
except Exception:
|
||||
# It is our 2facode, maybe
|
||||
key = f"2facode-{notification.id}".replace(" ", "")
|
||||
@@ -108,6 +109,7 @@ def send_sms_to_provider(notification):
|
||||
"sender": notification.reply_to_text,
|
||||
"international": notification.international,
|
||||
}
|
||||
print(hilite(f"send_sms_kwargs: {send_sms_kwargs}"))
|
||||
db.session.close() # no commit needed as no changes to objects have been made above
|
||||
|
||||
message_id = provider.send_sms(**send_sms_kwargs)
|
||||
|
||||
@@ -33,7 +33,7 @@ from app.schemas import (
|
||||
notifications_filter_schema,
|
||||
unarchived_template_schema,
|
||||
)
|
||||
from app.utils import midnight_n_days_ago, pagination_links
|
||||
from app.utils import hilite, midnight_n_days_ago, pagination_links
|
||||
|
||||
job_blueprint = Blueprint("job", __name__, url_prefix="/service/<uuid:service_id>/job")
|
||||
|
||||
@@ -172,6 +172,7 @@ def create_job(service_id):
|
||||
raise InvalidRequest("Create job is not allowed: service is inactive ", 403)
|
||||
|
||||
data = request.get_json()
|
||||
print(hilite(f"data at the top of create_job: {data}"))
|
||||
original_file_name = data.get("original_file_name")
|
||||
data.update({"service": service_id})
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user