def append_to_redis_array(redis_key, new_entry): # new_entry is an array that is to be combined with # the existing array in `redis_key` curr_redis_data = rds.get(redis_key) if curr_redis_data == None: curr_redis_data = "[]" current_data = json.loads(curr_redis_data) current_data += new_entry new_redis_data = json.dumps(current_data) rds.set(redis_key, new_redis_data)
def recog_person(): person_image_url = request.form.get("data_hash") post_url = config.facepp_compiled_person_get_path.format(person_image_url) irp = requests.post(post_url) irpp = json.loads(irp.text) try: recog_first_match = irpp["face"][0]["candidate"][0] recog_person_id = recog_first_match["person_id"] recog_person_confidence = recog_first_match["confidence"] if recog_person_confidence < 65: return "NO MATCH" spegill_user_redis_key = R_SPEGILL_USER % recog_person_id result = rds.get(spegill_user_redis_key + ":dump") return result except: return "ERR"