def waitforlogin(self, tip=1):
        """
        @brief      wait for scaning qrcode to login
        @param      tip   1: wait for scan qrcode
                          0: wait for confirm
        @return     Bool: whether operation succeed
        """
        time.sleep(tip)
        url = self.wx_conf['API_login'] + '?tip=%s&uuid=%s&_=%s' % (
            tip, self.uuid, int(time.time()))
        data = get(url)
        pm = re.search(r'window.code=(\d+);', data)
        code = pm.group(1)

        if code == '201':
            return True
        elif code == '200':
            pm = re.search(r'window.redirect_uri="(\S+?)";', data)
            r_uri = pm.group(1) + '&fun=new'
            self.redirect_uri = r_uri
            self.wx_host = r_uri.split('://')[1].split('/')[0]
            self.conf_factory()
            return True
        elif code == '408':
            echo(Constant.LOG_MSG_WAIT_LOGIN_ERR1)
        else:
            echo(Constant.LOG_MSG_WAIT_LOGIN_ERR2)
        return False

        @brief      wait for scaning qrcode to login
        @param      tip   1: wait for scan qrcode
                          0: wait for confirm
        @return     Bool: whether operation succeed
        
wxbot_project_py2.7/wechat/wechat_apis.py