Example #1
0
def download_tab2():
    tab2_filename = get_tab2_filename()
    s3_tab2_key = '{}/{}/Successful Files/{}'.format(get_year_from_sys_args(),
                                                     get_month_from_sys_args(),
                                                     tab2_filename)
    s3_client = get_s3_client()
    s3_client.download_file(get_s3_bucket(), s3_tab2_key, s3_tab2_key)
Example #2
0
def get_log_s3_key():
    s3_client = get_s3_client()
    log_prefix = get_s3_log_prefix()
    resp = s3_client.list_objects_v2(Bucket=get_s3_bucket(), Prefix=log_prefix)

    last_log_mod_datetime = None
    latest_log_s3_key = None
    for obj in resp['Contents']:
        if last_log_mod_datetime is None or obj[
                'LastModified'] > last_log_mod_datetime:
            latest_log_s3_key = obj['Key']
            last_log_mod_datetime = obj['LastModified']

    return latest_log_s3_key
Example #3
0
def upload_log():
    log_s3_key = get_log_s3_key()
    s3_client = get_s3_client()
    s3_client.upload_file(log_s3_key, get_s3_bucket(), log_s3_key)
Example #4
0
def download_log():
    log_s3_key = get_log_s3_key()
    s3_client = get_s3_client()
    s3_client.download_file(get_s3_bucket(), log_s3_key, log_s3_key)