No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

41 líneas
1.2KB

  1. """
  2. channel factory
  3. """
  4. def create_channel(channel_type):
  5. """
  6. create a channel instance
  7. :param channel_type: channel type code
  8. :return: channel instance
  9. """
  10. if channel_type == "wx":
  11. from channel.wechat.wechat_channel import WechatChannel
  12. return WechatChannel()
  13. elif channel_type == "wxy":
  14. from channel.wechat.wechaty_channel import WechatyChannel
  15. return WechatyChannel()
  16. elif channel_type == "terminal":
  17. from channel.terminal.terminal_channel import TerminalChannel
  18. return TerminalChannel()
  19. elif channel_type == "wechatmp":
  20. from channel.wechatmp.wechatmp_channel import WechatMPChannel
  21. return WechatMPChannel(passive_reply=True)
  22. elif channel_type == "wechatmp_service":
  23. from channel.wechatmp.wechatmp_channel import WechatMPChannel
  24. return WechatMPChannel(passive_reply=False)
  25. elif channel_type == "wechatcom_app":
  26. from channel.wechatcom.wechatcomapp_channel import WechatComAppChannel
  27. return WechatComAppChannel()
  28. elif channel_type == "wework":
  29. from channel.wework.wework_channel import WeworkChannel
  30. return WeworkChannel()
  31. raise RuntimeError