25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
740B

  1. import json
  2. from flask_classy import FlaskView, route
  3. from modules.core.core import cbpi
  4. class ActionView(FlaskView):
  5. @route('/<action>', methods=['POST'])
  6. def action(self, action):
  7. """
  8. Call global action button
  9. ---
  10. tags:
  11. - action
  12. responses:
  13. 200:
  14. description: action invoked
  15. """
  16. print self.cbpi.cache["actions"]
  17. self.cbpi.cache["actions"][action]["function"](self.cbpi)
  18. return ('',204)
  19. @cbpi.addon.core.initializer()
  20. def init(cbpi):
  21. """
  22. Initializer for the message module
  23. :param app: the flask app
  24. :return: None
  25. """
  26. ActionView.cbpi = cbpi
  27. ActionView.register(cbpi._app, route_base='/api/action')