def setUp(self): super().setUp() self.redis.delete('nextid:current') self.ids = NextId() for master in self.ids.masters: master.set(self.ids.key, 0)
response.headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, OPTIONS' response.headers['Access-Control-Allow-Headers'] = 'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token' if bottle.request.method != 'OPTIONS': # actual request; reply with the actual response return fn(*args, **kwargs) return _enable_cors #connection with redis-py client dir_con = red(host = '13.126.191.137',port = 6379,db = 0, password = '******') #connection with pottery client pot_con = red.from_url('redis://:[email protected]:6379/') rest_ids = NextId(key='rest-ids', masters={pot_con}) #string encode with b prefix def bytify(strung): return bytes(strung, encoding = "ascii") def byte2string(strung): return strung.decode('utf-8') def byte2int(strung): return int(byte2string(strung)) def byte2float(strung): return float(byte2string(strung)) '''
def setUp(self): super().setUp() self.ids = NextId() for master in self.ids.masters: master.set(self.ids.key, 0)