import redis class Database: def __init__(self): self.host = 'localhost' self.port = 6379 def write(self,website,city,year,month,day,deal_number): try: key = '_'.join([website,city,str(year),str(month),str(day)]) val = deal_number r = redis.StrictRed…