This repository has been archived on 2025-07-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
hacknotts23/api/db.py
2023-02-11 19:00:49 +00:00

20 lines
442 B
Python

import redis
redis_url = 'redis://default:redispw@localhost:32768'
r = redis.StrictRedis.from_url(redis_url)
'''r.set('hello', 'world')
value = r.get('hello')
print(value)'''
class DB:
def getEntry(self, tiploc):
return r.hget("tiploc", tiploc)
def getHash(self, tiploc):
response = r.hgetall("tiploc:"+tiploc)
response = {a.decode(): response[a].decode() for a in response}
return response