def build_info(keys: str = Header(...), keyvalues: str = Header(...), maxbuilds: str = Header(...), token: str = Header(...)): # TODO get either address or longitude or longitude of building # TODO return all information as well as risk assessment # TODO return tips to make better """ Return list of buildings and their values based on the keys used. """ endpoint = 'build-info' return_dict = {'success': False} try: print("Executing {} endpoint".format(endpoint)) role = registration.Login.validate_jwt_token(token)['roles'] keys, keyvalues = keys.split('|'), keyvalues.split('|') if len(keys) == 0 or len(keyvalues) == 0: raise Exception('No query key found') build_obj = Building(role, keys[1:], keyvalues[1:], maxbuilds) return_dict['result'] = build_obj.retrieve_from_db() return_dict['success'] = True return JSONResponse(content=return_dict) except CustomException as ce: error_code, error = str(ce).split(':') return print_exception(error, error_code, endpoint, return_dict) except Exception as e: return print_exception(str(e), 400, endpoint, return_dict)