Reads errors.json from optout_s3_bucket into error_numbers for removing from cleaned list

This commit is contained in:
Rick Ross 2023-12-08 17:28:05 -08:00
parent a29a40b6bb
commit 479b6efff1
1 changed files with 9 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import os
import logging
import uuid
import time
import codecs
import phonenumbers
@ -189,6 +190,14 @@ class AFCMUniverseMapFile:
generate_mapped_file Generate the mapped file details
"""
try:
errors_filename_s3_key = "errors.json"
file_data_stream = self.optout_s3_connection.get_object(self.optout_s3_bucket,
errors_filename_s3_key)
self.error_numbers = json.load(codecs.getreader("utf-8")(file_data_stream))
except Exception as ex:
raise Exception(f"universe_map_file.generate_mapped_file: Failed to get {self.optout_s3_bucket}/{errors_filename_s3_key}: {ex}") from ex
# Loop the files from the map
for ufilename in self.mosaic_file_list:
self.process_file(ufilename)