def get_list(self, verbose=False, content=True, list_id="-1", user_id=None, access_token=None): if type(content) != types.BooleanType: content = strtobool(content) if type(verbose) != types.BooleanType: verbose = strtobool(verbose) conn = species_list_service.connect_mongodb() service_result = species_list_service.get_list(conn, user_id, int(list_id), verbose, content, access_token) conn.close() return service_result;
def replace_species(self,**request_data): try: input_json = cherrypy.request.json access_token = input_json["access_token"] user_id = input_json["user_id"] except KeyError, e: return return_response_error(400,"Error: Missing parameter %s"%(str(e)),"NotJSON") except Exception, e: return return_response_error(400,"Error:" + str(e), "NotJSON") #verify user token_verification = authenticate_user.verify_access_token(access_token, user_id) if not(token_verification['is_access_token_valid']): return return_response_error(400,"Error:"+ token_verification['message'],"NotJSON") #allow access to service for verified user conn = species_list_service.connect_mongodb() service_result = species_list_service.replace_species_in_list(input_json, conn) conn.close() return service_result; #----------------------------------------------- @cherrypy.tools.json_out() @cherrypy.tools.json_in() def update_list(self,**request_data): try: input_json = cherrypy.request.json access_token = input_json["access_token"] user_id = input_json["user_id"] except KeyError, e: return return_response_error(400,"Error: Missing parameter %s"%(str(e)),"NotJSON")