def get_mou(organisation_is_crown):
    bucket = current_app.config["MOU_BUCKET_NAME"]
    filename = "crown.pdf" if organisation_is_crown else "non-crown.pdf"
    attachment_filename = "Data sharing and financial agreement{}.pdf".format("" if organisation_is_crown else " (non-crown)")
    try:
        key = get_s3_object(bucket, filename)
        return {
            "filename_or_fp": key.get()["Body"],
            "attachment_filename": attachment_filename,
            "as_attachment": True,
        }
    except botocore.exceptions.ClientError as exception:
        current_app.logger.error("Unable to download s3 file {}/{}".format(bucket, filename))
        raise exception
Example #2
0
def get_mou(organisation_is_crown):
    bucket = current_app.config['MOU_BUCKET_NAME']
    filename = 'crown.pdf' if organisation_is_crown else 'non-crown.pdf'
    attachment_filename = 'Notify data sharing and financial agreement{}.pdf'.format(
        '' if organisation_is_crown else ' (non-crown)')
    try:
        key = get_s3_object(bucket, filename)
        return {
            'filename_or_fp': key.get()['Body'],
            'attachment_filename': attachment_filename,
            'as_attachment': True,
        }
    except botocore.exceptions.ClientError as exception:
        current_app.logger.error("Unable to download s3 file {}/{}".format(
            bucket, filename))
        raise exception
def get_csv_upload(service_id, upload_id):
    return get_s3_object(*get_csv_location(service_id, upload_id))
def get_csv_upload(service_id, upload_id, bucket=None):
    return get_s3_object(*get_csv_location(service_id, upload_id, bucket))