merge from main

This commit is contained in:
Kenneth Kehl
2025-01-07 07:10:14 -08:00
6 changed files with 27 additions and 25 deletions

View File

@@ -15,4 +15,4 @@ runs:
python-version: "3.12.3" python-version: "3.12.3"
- name: Install poetry - name: Install poetry
shell: bash shell: bash
run: pip install --upgrade poetry run: pip install poetry==1.8.5

View File

@@ -9,10 +9,12 @@ GIT_COMMIT ?= $(shell git rev-parse HEAD)
## DEVELOPMENT ## DEVELOPMENT
## TODO this line should go under `make generate-version-file`
## poetry self update
.PHONY: bootstrap .PHONY: bootstrap
bootstrap: ## Set up everything to run the app bootstrap: ## Set up everything to run the app
make generate-version-file make generate-version-file
poetry self update
poetry self add poetry-dotenv-plugin poetry self add poetry-dotenv-plugin
poetry lock --no-update poetry lock --no-update
poetry install --sync --no-root poetry install --sync --no-root

View File

@@ -1,7 +1,9 @@
import csv
import datetime import datetime
import re import re
import time import time
from concurrent.futures import ThreadPoolExecutor from concurrent.futures import ThreadPoolExecutor
from io import StringIO
import botocore import botocore
from boto3 import Session from boto3 import Session
@@ -395,31 +397,25 @@ def get_job_from_s3(service_id, job_id):
def extract_phones(job): def extract_phones(job):
job = job.split("\r\n") job_csv_data = StringIO(job)
first_row = job[0] csv_reader = csv.reader(job_csv_data)
job.pop(0) first_row = next(csv_reader)
first_row = first_row.split(",")
phone_index = 0 phone_index = 0
for item in first_row: for i, item in enumerate(first_row):
# Note: may contain a BOM and look like \ufeffphone number if item.lower().lstrip("\ufeff") == "phone number":
if item.lower() in [ phone_index = i
"phone number",
"\\ufeffphone number",
"\\ufeffphone number\n",
"phone number\n",
]:
break break
phone_index = phone_index + 1
phones = {} phones = {}
job_row = 0 job_row = 0
for row in job: for row in csv_reader:
row = row.split(",")
if phone_index >= len(row): if phone_index >= len(row):
phones[job_row] = "Unavailable" phones[job_row] = "Unavailable"
current_app.logger.error( current_app.logger.error(
"Corrupt csv file, missing columns or possibly a byte order mark in the file", f"Corrupt csv file, missing columns or\
possibly a byte order mark in the file, row looks like {row}",
) )
else: else:

View File

@@ -54,7 +54,7 @@ def _create_service_invite(invited_user, nonce, state):
data["invited_user_email"] = invited_user.email_address data["invited_user_email"] = invited_user.email_address
invite_redis_key = f"invite-data-{unquote(state)}" invite_redis_key = f"invite-data-{unquote(state)}"
redis_store.set(invite_redis_key, get_user_data_url_safe(data)) redis_store.set(invite_redis_key, get_user_data_url_safe(data), ex=2 * 24 * 60 * 60)
url = os.environ["LOGIN_DOT_GOV_REGISTRATION_URL"] url = os.environ["LOGIN_DOT_GOV_REGISTRATION_URL"]

14
poetry.lock generated
View File

@@ -2829,14 +2829,18 @@ version = "1.3.0"
description = "TLS (SSL) sockets, key generation, encryption, decryption, signing, verification and KDFs using the OS crypto libraries. Does not require a compiler, and relies on the OS for patching. Works on Windows, OS X and Linux/BSD." description = "TLS (SSL) sockets, key generation, encryption, decryption, signing, verification and KDFs using the OS crypto libraries. Does not require a compiler, and relies on the OS for patching. Works on Windows, OS X and Linux/BSD."
optional = false optional = false
python-versions = "*" python-versions = "*"
files = [ files = []
{file = "oscrypto-1.3.0-py2.py3-none-any.whl", hash = "sha256:2b2f1d2d42ec152ca90ccb5682f3e051fb55986e1b170ebde472b133713e7085"}, develop = false
{file = "oscrypto-1.3.0.tar.gz", hash = "sha256:6f5fef59cb5b3708321db7cca56aed8ad7e662853351e7991fcf60ec606d47a4"},
]
[package.dependencies] [package.dependencies]
asn1crypto = ">=1.5.1" asn1crypto = ">=1.5.1"
[package.source]
type = "git"
url = "https://github.com/wbond/oscrypto.git"
reference = "1547f53"
resolved_reference = "1547f535001ba568b239b8797465536759c742a3"
[[package]] [[package]]
name = "packageurl-python" name = "packageurl-python"
version = "0.16.0" version = "0.16.0"
@@ -4947,4 +4951,4 @@ propcache = ">=0.2.0"
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = "^3.12.2" python-versions = "^3.12.2"
content-hash = "271d8e0f25856f45970e5a9cc3b8871a01b732226ab3ed68ea426912b5117fcf" content-hash = "81a109693e74d2ffa3be7098e629050f25090c6a08bab57056b9a4a35283ea6f"

View File

@@ -40,7 +40,7 @@ marshmallow = "==3.22.0"
marshmallow-sqlalchemy = "==1.0.0" marshmallow-sqlalchemy = "==1.0.0"
newrelic = "*" newrelic = "*"
notifications-python-client = "==10.0.0" notifications-python-client = "==10.0.0"
oscrypto = "==1.3.0" oscrypto = { git = "https://github.com/wbond/oscrypto.git", rev = "1547f53" }
packaging = "==24.1" packaging = "==24.1"
poetry-dotenv-plugin = "==0.2.0" poetry-dotenv-plugin = "==0.2.0"
psycopg2-binary = "==2.9.9" psycopg2-binary = "==2.9.9"