def GET(self, number_of_words=8): iid = crypto.genrandomid(number_of_words) web.header("Cache-Control", "no-cache, no-store, must-revalidate") web.header("Pragma", "no-cache") web.header("Expires", "-1") return render.generate(iid)
def GET(self, number_of_words=8): if (number_of_words not in range(4, 11)): raise web.notfound() iid = crypto.genrandomid(number_of_words) web.header('Cache-Control', 'no-cache, no-store, must-revalidate') web.header('Pragma', 'no-cache') web.header('Expires', '-1') return render.generate(iid)
def GET(self): web.header("Content-Type", "application/json") request_params = web.input() if "words" in request_params: word_num = int(request_params["words"]) uid = crypto.genrandomid(word_num) return json.dumps({"result": "success", "id": uid}) else: return json.dumps({"result": "fail"})
def GET(self): web.header('Content-Type', 'application/json') request_params = web.input() if 'words' in request_params: word_num = int(request_params['words']) if (word_num not in range(4, 11)): raise web.notfound() uid = crypto.genrandomid(word_num) return json.dumps({'result': 'success', 'id': uid}) else: return json.dumps({'result': 'fail'})
def POST(self): iid = crypto.genrandomid() if os.path.exists(store.path(crypto.shash(iid))): # if this happens, we're not using very secure crypto store.log('Got a duplicate ID.') else: os.mkdir(store.path(crypto.shash(iid))) web.header('Cache-Control', 'no-cache, no-store, must-revalidate') web.header('Pragma', 'no-cache') web.header('Expires', '-1') return render.generate(iid)