Added process for dvla acknowledgement file

Daily schedule task to check ack file against zip file lists
if we haven't receive ack for a zip file, raise a 500 exception
This commit is contained in:
venusbb
2018-01-12 15:10:42 +00:00
parent 9c4e43bfac
commit 24b785e7e0
8 changed files with 173 additions and 17 deletions

View File

@@ -107,3 +107,19 @@ def upload_letters_pdf(reference, crown, filedata):
current_app.logger.info("Uploading letters PDF {} to {}".format(
upload_file_name, current_app.config['LETTERS_PDF_BUCKET_NAME']))
def get_list_of_files_by_suffix(bucket_name, subfolder='', suffix=''):
s3_client = client('s3', current_app.config['AWS_REGION'])
paginator = s3_client.get_paginator('list_objects_v2')
page_iterator = paginator.paginate(
Bucket=bucket_name,
Prefix=subfolder
)
for page in page_iterator:
for obj in page['Contents']:
key = obj['Key']
if key.endswith(suffix):
yield key