I get the deprication warning, that Redis.hmset() is deprecated. Use Redis.hset() instead.
However hset() takes a third parameter and I can't figure out what name
is supposed to be.
info = {'users': 10, "timestamp": datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')}
r.hmset("myKey", info)
The above works, but this requires a first parameter called name.
r.hset(name, "myKey", info)
hset("myKey", mapping=info)
. – Iliadmapping
kwarg was added in 3.5.0 (Apr 29, 2020). If your version is older, you will need to do as @Ersoy suggests. – Iliadredis-3.5.2
makes the warning in PyCharm go away. Now I don't know which answer to accept. Both are correct. I think for clarity I go with Ersoy. Thanks both. – Planetary