hbp_nrp_backend.rest_server package

This package contains the implementation of the REST server to control experiments

class ErrorMessages[source]

Bases: object

Definition of error strings

ACTIVATION_ERROR_400 = 'The (de-)activation of the Transfer Function has failed'
DUPLICATE_NAME_403 = 'Name already exists'
ERROR_IN_BASE64_400 = 'Error in base64: {0}'
ERROR_SAVING_FILE_500 = 'Error saving file'
EXPERIMENT_BIBI_FILE_NOT_FOUND_404 = 'The experiment BIBI file was not found'
EXPERIMENT_CONF_FILE_NOT_FOUND_404 = 'The experiment configuration file was not found'
EXPERIMENT_NOT_FOUND_404 = 'The experiment with the given ID was not found'
EXP_VARIABLE_ERROR = "Error on server: environment variable: 'NRP_EXPERIMENTS_DIRECTORY' is empty"
MODEXP_VARIABLE_ERROR = "Error on server: environment variable: 'NRP_MODELS_DIRECTORY' or 'NRP_EXPERIMENTS_DIRECTORY' is empty"
MOD_VARIABLE_ERROR = "Error on server: environment variable: 'NRP_MODELS_DIRECTORY' is empty"
OPERATION_INVALID_IN_CURRENT_STATE_403 = 'The operation is forbidden while the simulation is in its current state'
SERVER_ERROR_500 = 'The query failed due to an internal server error'
SIMULATION_NOT_FOUND_404 = 'The simulation with the given ID was not found'
SIMULATION_PERMISSION_401 = 'Insufficient permissions to apply changes. Operation only allowed by simulation owner'
SIMULATION_PERMISSION_401_VIEW = 'Insufficient permissions to see the simulation changes.You can only see the simulations you own or those for which the experiment has been shared with you'
SOURCE_CODE_ERROR_400 = 'The source code is invalid: [ERROR-MESSAGE]'
class NRPServicesExtendedApi(app=None, prefix='', default_mediatype='application/json', decorators=None, catch_all_404s=False, serve_challenge_on_401=False, url_part_order='bae', errors=None)[source]

Bases: flask_restful.Api

Extend Flask Restful error handling mechanism so that we can still use original Flask error handlers (defined in __ErrorHandlers.py)

error_router(original_handler, e)[source]

Route the error

Parameters
  • original_handler – Flask handler

  • e – Error

class ParamNames[source]

Bases: object

Constants to be used as parameter names

IS_CUSTOM = 'isCustom'
ROBOT_ABS_PATH = 'robotAbsPath'
ROBOT_ID = 'robotId'
ROBOT_MODEL = 'robotModel'
ROBOT_PATH = 'robotPath'
ROBOT_POSE = 'robotPose'
ROBOT_REL_PATH = 'robotRelPath'