[python] 使用密码连接redis服务器 Connect redis with password

第一种方法:

rds = redis.StrictRedis(host='localhost', port=6379, password='123456')

第二种方法:

redis_config = {
        'host': os.getenv('REDIS_HOST', '127.0.0.1'),
        'port': os.getenv('REDIS_PORT', 6379),
        'password': os.getenv('REDIS_PWD', '123456')
    }
redis_uri = 'redis://:{password}@{host}:{port}/0'.format(**redis_config)
redis = Redis.from_url(redis_uri)