def get_secretkey()

in ec2stack/helpers.py [0:0]


def get_secretkey(data=None):
    """
    Get the secret key from the database.

    @param data: Data to get the API KEY from.
    @return: The users secret key.
    @raise Ec2stackError: if the secretkey is not found.
    """
    if data is None:
        data = request.form

    apikey = get('AWSAccessKeyId', data)
    user = USERS.get(apikey)

    if user is None:
        errors.apikey_not_found(apikey)

    return user.secretkey.encode('utf-8')