def gen_api_key ( username ) : salt = str ( os . urandom ( 64 ) ) . encode ( 'utf-8' ) return hash_password ( username , salt )
generate a random apikey for a user python
Create a random API key for a user : param username : : return : Hex encoded SHA512 random string
def gen_api_key(username):
    """
    Create a random API key for a user
    :param username:
    :return: Hex encoded SHA512 random string
    """
    salt = str(os.urandom(64)).encode('utf-8')
    return hash_password(username, salt)