您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

channel_factory.py 735B

1234567891011121314151617181920212223
  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()
  22. raise RuntimeError