import redis r = redis.Redis(host='db.ptt.cx', port=6379, db=1) r.set('foo', 'bar') print(r.get('foo'))