25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

36 satır
790B

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