hbp_nrp_backend package

This package contains the python code to run the REST server.

It leverages the Flask REST and Flask-restful frameworks.

exception hbp_nrp_backend.NRPServicesClientErrorException(message, error_type='Client error', error_code=400)[source]

Bases: hbp_nrp_backend.NRPServicesGeneralException

Exception class for client (4xx) errors. It can be used to return meaningful messages to the ExD frontend.

Parameters
  • message – message displayed to the end user.

  • error_code – The HTTP error code to send to the frontend.

exception hbp_nrp_backend.NRPServicesGeneralException(message, error_type, error_code=500, data=None)[source]

Bases: Exception

General exception class that can be used to return meaningful messages to the ExD frontend.

Parameters
  • message – message displayed to the end user.

  • error_type – Type of error (like ‘Loading Error’)

  • error_code – The HTTP error code to send to the frontend.

exception hbp_nrp_backend.NRPServicesStateException(message)[source]

Bases: hbp_nrp_backend.NRPServicesGeneralException

State exception class that can be used to return meaningful messages to the HBP frontend.

Parameters

message – message displayed to the end user.

exception hbp_nrp_backend.NRPServicesWrongUserException(message='You need to be the simulation owner to apply your changes or the simulation should be shared with you for you to be able to access it.Wrong user')[source]

Bases: hbp_nrp_backend.NRPServicesClientErrorException

Exception class that can be used to return meaningful messages to the HBP frontend in case an invalid user is detected.

Parameters

message – message displayed to the end user.

hbp_nrp_backend.get_date_and_time_string()[source]

Utility function that returns a string reflecting the current date and time with a format that is suitable for file or folder names

Returns

a string containing the date and time under the format YYYY-mm-dd_HH-MM-SS