The redis-py client provides two classes StrictRedis and Redis to establish a basic connection to a Redis database. The Redis class is provided for backwards compatibility and new projects should use the StrictRedis class.
One of the recommended ways to establish a connection, is to define the connection parameters in a dictionary and pass the dictionary to the StrictRedis constructor using the ** syntax.
conn_params = {
"host": "myredis.somedomain.com",
"port": 6379,
"password": "sekret",
"db": 0
}
r = redis.StrictRedis(**config)