def load_config()

in amazon_polly_async_batch/setprocessor.py [0:0]


def load_config(bucket, key):
    """
    Given a bucket name and a key which contains a configuration file, loads it up and returns it as a Config object

    :param bucket: the S3 bucket where the config file is
    :param key: the key of the file
    :return: a populated Config object
    """
    try:
        # Pull down and parse the set file
        s3_object = s3.get_object(Bucket=bucket, Key=key)
        s3_object_content = s3_object['Body'].read().decode('utf-8')
        return config.Config(s3_object_content)
    except Exception as e:
        msg = 'Failed to load configuration file at {}/{} because {}'.format(bucket, key, str(e))
        raise Exception(msg)