Пример #1
0
    def init_with_config(self, config):
        session_interface = self._init_session(config)

        if config['WECHAT_TYPE'] == 17:
            from wechatpy.component import WeChatComponent
            self._is_component = True
            return WeChatComponent(
                config['WECHAT_APPID'],
                config['WECHAT_SECRET'],
                config['WECHAT_TOKEN'],
                config['WECHAT_AES_KEY'],
                session=session_interface,
            )

        if config['WECHAT_TYPE'] == 0:
            from wechatpy import WeChatClient
        else:
            from wechatpy.enterprise import WeChatClient

        return WeChatClient(
            config['WECHAT_APPID'],
            config['WECHAT_SECRET'],
            session=session_interface,
            timeout=config['WECHAT_TIMEOUT'],
            auto_retry=config['WECHAT_AUTO_RETRY'],
        )
Пример #2
0
 def setUp(self):
     component = WeChatComponent(
         self.component_appid,
         self.component_appsecret,
         self.component_token,
         self.encoding_aes_key,
     )
     self.oauth = ComponentOAuth(
         component,
         self.app_id,
     )
Пример #3
0
 def setUp(self):
     self.client = WeChatComponent(self.app_id, self.app_secret, self.token, self.encoding_aes_key)
Пример #4
0
 def setUp(self):
     self.client = WeChatComponent(self.app_id, self.app_secret)