import redis
POOL = redis.ConnectionPool(host='10.0.0.1', port=6379, db=0)

def getVariable(variable_name):
    my_server = redis.Redis(connection_pool=POOL)
response = my_server.get(variable_name)
return response

def setVariable(variable_name, variable_value):
    my_server = redis.Redis(connection_pool=POOL)
my_server.set(variable_name, variable_value)
Управление подключением к Redis из Python