Compare commits

...

23 Commits

Author SHA1 Message Date
Andrew Shumway
e956ca5017 Add more debug 2024-07-23 13:37:52 -06:00
Andrew Shumway
bba3fb1d73 Debug 2024-07-17 07:46:00 -06:00
Andrew Shumway
ce729c2f26 pull main 2024-07-10 11:03:06 -06:00
Andrew Shumway
27b7d8c70d Merge branch 'main' of https://github.com/GSA/notifications-api 2024-07-10 08:41:11 -06:00
Andrew Shumway
5cd2e8416b Merge branch 'main' of https://github.com/GSA/notifications-api 2024-07-05 09:07:34 -06:00
Andrew Shumway
c78a53eb25 Merge branch 'main' of https://github.com/GSA/notifications-api 2024-06-27 08:45:37 -06:00
Andrew Shumway
9c1832cac0 Merge branch 'main' of https://github.com/GSA/notifications-api 2024-06-12 09:30:58 -06:00
Andrew Shumway
50d7b9a7be poetry lock 2024-06-03 15:53:59 -06:00
Andrew Shumway
c2f29ee0dd Merge branch 'main' of https://github.com/GSA/notifications-api 2024-05-31 09:31:39 -06:00
Andrew Shumway
99ee0e21d9 poetry lock 2024-05-29 10:07:23 -06:00
Andrew Shumway
11cb5d9682 Merge branch 'main' of https://github.com/GSA/notifications-api 2024-05-10 10:26:20 -06:00
Andrew Shumway
1e1a6dffd7 poetry lock 2024-05-10 10:26:10 -06:00
Andrew Shumway
27d6579133 Merge branch 'main' of https://github.com/GSA/notifications-api 2024-05-08 09:00:43 -06:00
Andrew Shumway
a76237b7a9 Merge branch 'main' of https://github.com/GSA/notifications-api 2024-05-02 14:16:36 -06:00
Andrew Shumway
bd5f43d28f poetry lock 2024-04-26 10:16:04 -06:00
Andrew Shumway
482be89519 Merge branch 'main' of https://github.com/GSA/notifications-api 2024-04-25 15:27:49 -06:00
Andrew Shumway
ed61be8736 Poetry lock 2024-04-24 09:30:37 -06:00
Andrew Shumway
cc0c8ddd30 Merge branch 'main' of https://github.com/GSA/notifications-api 2024-04-24 09:30:23 -06:00
Andrew Shumway
da4dbc9c85 Merge branch 'main' of https://github.com/GSA/notifications-api 2024-04-22 10:47:05 -06:00
Andrew Shumway
16a7bee93e poetry lock 2024-04-22 10:47:00 -06:00
Andrew Shumway
9cf048b754 Merge branch 'main' of https://github.com/GSA/notifications-api 2024-04-18 10:15:04 -06:00
Andrew Shumway
c6c05caf44 Merge branch 'main' of https://github.com/GSA/notifications-api 2024-04-16 14:51:15 -06:00
Andrew Shumway
e1382989c3 poetry lock 2024-04-16 14:51:11 -06:00
7 changed files with 29 additions and 7 deletions

View File

@@ -1,5 +1,7 @@
import re
import csv
from app.utils import hilite
import botocore
from boto3 import Session
from expiringdict import ExpiringDict
@@ -124,17 +126,28 @@ def extract_phones(job):
def extract_personalisation(job):
print(hilite(f"job type: {type(job)}"))
print(hilite(f"Job? {job}"))
job = job.split("\r\n")
print(hilite(f"job after first split: {job}"))
first_row = job[0]
print(hilite(f"first_row: {first_row}"))
job.pop(0)
first_row = first_row.split(",")
print(hilite(f"first_row again: {first_row}"))
personalisation = {}
job_row = 0
for row in job:
row = row.split(",")
row_csv_module = csv.reader(job)
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}"))
print(hilite(f"personalisation: {personalisation}"))
return personalisation
@@ -190,6 +203,7 @@ def get_personalisation_from_s3(service_id, job_id, job_row_number):
job = JOBS.get(job_id)
if job is None:
job = get_job_from_s3(service_id, job_id)
print(hilite(f"job at the beginning: {job}"))
JOBS[job_id] = job
incr_jobs_cache_misses()
else:

View File

@@ -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 (

View File

@@ -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.

View File

@@ -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 = {

View File

@@ -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)

View File

@@ -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:

5
poetry.lock generated
View File

@@ -2098,9 +2098,13 @@ files = [
{file = "lxml-5.2.2-cp36-cp36m-win_amd64.whl", hash = "sha256:edcfa83e03370032a489430215c1e7783128808fd3e2e0a3225deee278585196"},
{file = "lxml-5.2.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:28bf95177400066596cdbcfc933312493799382879da504633d16cf60bba735b"},
{file = "lxml-5.2.2-cp37-cp37m-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3a745cc98d504d5bd2c19b10c79c61c7c3df9222629f1b6210c0368177589fb8"},
{file = "lxml-5.2.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1b590b39ef90c6b22ec0be925b211298e810b4856909c8ca60d27ffbca6c12e6"},
{file = "lxml-5.2.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b336b0416828022bfd5a2e3083e7f5ba54b96242159f83c7e3eebaec752f1716"},
{file = "lxml-5.2.2-cp37-cp37m-manylinux_2_28_aarch64.whl", hash = "sha256:c2faf60c583af0d135e853c86ac2735ce178f0e338a3c7f9ae8f622fd2eb788c"},
{file = "lxml-5.2.2-cp37-cp37m-manylinux_2_28_x86_64.whl", hash = "sha256:4bc6cb140a7a0ad1f7bc37e018d0ed690b7b6520ade518285dc3171f7a117905"},
{file = "lxml-5.2.2-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:7ff762670cada8e05b32bf1e4dc50b140790909caa8303cfddc4d702b71ea184"},
{file = "lxml-5.2.2-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:57f0a0bbc9868e10ebe874e9f129d2917750adf008fe7b9c1598c0fbbfdde6a6"},
{file = "lxml-5.2.2-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:a6d2092797b388342c1bc932077ad232f914351932353e2e8706851c870bca1f"},
{file = "lxml-5.2.2-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:60499fe961b21264e17a471ec296dcbf4365fbea611bf9e303ab69db7159ce61"},
{file = "lxml-5.2.2-cp37-cp37m-win32.whl", hash = "sha256:d9b342c76003c6b9336a80efcc766748a333573abf9350f4094ee46b006ec18f"},
{file = "lxml-5.2.2-cp37-cp37m-win_amd64.whl", hash = "sha256:b16db2770517b8799c79aa80f4053cd6f8b716f21f8aca962725a9565ce3ee40"},
@@ -2489,7 +2493,6 @@ files = [
{file = "msgpack-1.0.8-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5fbb160554e319f7b22ecf530a80a3ff496d38e8e07ae763b9e82fadfe96f273"},
{file = "msgpack-1.0.8-cp39-cp39-win32.whl", hash = "sha256:f9af38a89b6a5c04b7d18c492c8ccf2aee7048aff1ce8437c4683bb5a1df893d"},
{file = "msgpack-1.0.8-cp39-cp39-win_amd64.whl", hash = "sha256:ed59dd52075f8fc91da6053b12e8c89e37aa043f8986efd89e61fae69dc1b011"},
{file = "msgpack-1.0.8-py3-none-any.whl", hash = "sha256:24f727df1e20b9876fa6e95f840a2a2651e34c0ad147676356f4bf5fbb0206ca"},
{file = "msgpack-1.0.8.tar.gz", hash = "sha256:95c02b0e27e706e48d0e5426d1710ca78e0f0628d6e89d5b5a5b91a5f12274f3"},
]