telnet_Utils.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:warriorframework 作者: warriorframework 项目源码 文件源码
def read(self, prompt='', timeout=60):
        ''' Reads the output till the prompt and returns the result and
        reports Failure on mismatch of response'''
        if not prompt:
            prompt = self.ne_prompt
        res = self.tnet.expect([prompt], timeout)
        self.cmd_rsp = res[2]
        try:
            if res:
                self.log.write(res[2])
                self.log.flush()
            else:
                self.log.write("Expected Prompt Not found.", res)
                self.log.flush()
                #re.search(prompt, self.cmd_rsp)
        except re.error:
            print_debug( "Expected Response:{0}".format( prompt))
            print_debug( "Received Response:{0}".format(self.cmd_rsp))
        return self.cmd_rsp
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号