import redis r = redis.StrictRedis(host='localhost', port=6379, db=0) r.set('foo', 'bar') val = r.get('foo') print(val)