From 100948b4df6b4db5d1c8cc3d4dad87049b8b7696 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Magalh=C3=A3es?= Date: Tue, 14 Dec 2021 23:46:18 +0000 Subject: [PATCH] Fix redis GEOADD Redis python interface only accepts two arguments, the keyname to store in redis and a value-list with the coordinates and content to which the coordinates refer, in groups of three. --- helpers/geo_helper.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/helpers/geo_helper.py b/helpers/geo_helper.py index 5fe678b..4900732 100644 --- a/helpers/geo_helper.py +++ b/helpers/geo_helper.py @@ -208,11 +208,15 @@ class Geo_helper: today_str = util.getDateStrFormat(now) keyname = "{}:{}".format(keyCateg, today_str) try: - self.serv_redis_db.geoadd(keyname, lon, lat, content) + self.serv_redis_db.geoadd(keyname, [lon, lat, content]) except redis.exceptions.ResponseError as error: print(error) print("Please fix the above, and make sure you use a redis version that supports the GEOADD command.") print("To test for support: echo \"help GEOADD\"| redis-cli") + except redis.exceptions.DataError as error: + print(error) + print("Please fix the above, and make sure you use a redis version that supports the GEOADD command.") + print("To test for support: echo \"help GEOADD\"| redis-cli") self.logger.debug('Added to redis: keyname={}, lon={}, lat={}, content={}'.format(keyname, lon, lat, content)) def push_to_redis_zset(self, keyCateg, toAdd, endSubkey="", count=1):