mirror of https://github.com/MISP/misp-dashboard
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.pull/161/head
parent
c093363e99
commit
100948b4df
|
@ -208,11 +208,15 @@ class Geo_helper:
|
||||||
today_str = util.getDateStrFormat(now)
|
today_str = util.getDateStrFormat(now)
|
||||||
keyname = "{}:{}".format(keyCateg, today_str)
|
keyname = "{}:{}".format(keyCateg, today_str)
|
||||||
try:
|
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:
|
except redis.exceptions.ResponseError as error:
|
||||||
print(error)
|
print(error)
|
||||||
print("Please fix the above, and make sure you use a redis version that supports the GEOADD command.")
|
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")
|
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))
|
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):
|
def push_to_redis_zset(self, keyCateg, toAdd, endSubkey="", count=1):
|
||||||
|
|
Loading…
Reference in New Issue