Python-telnet-自动化APC PDU [英] Python - telnet - automation APC PDU
本文介绍了Python-telnet-自动化APC PDU的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 python 的内置 telnet 功能自动关闭连接到 APC PDU 的设备.我相信我可以输入用户名和密码,但之后我无法继续.我的代码如下:
I am attempting to automation turning off connected devices to an APC PDU using python's built in telnet functionality. I believe I am able to enter in the username and password, but I cannot proceed after that. My code is as follows:
telnet_session = telnetlib.Telnet(host=self.apc_ip)
self.logger.info("Entering APC Username")
telnet_session.read_until("User Name :")
telnet_session.write(self.apc_username + "
")
self.logger.info("Entering APC Password")
telnet_session.read_until("Password :")
telnet_session.write(self.apc_password + "
")
sleep(2)
print telnet_session.read_all()
我运行的是 Windows,所以我相信 https://github.com/quackenbush/APC不是一个选项,因为我无法安装 pexpect.
I'm running windows so I believe that https://github.com/quackenbush/APC is not an option as I cannot install pexpect.
任何帮助将不胜感激.
谢谢,
部分
推荐答案
问题是我没有发送正确的结束行.
The issue was I wasn't sending the correct end line.
在 Windows 中是 ,而不是
In windows it's , not
这篇关于Python-telnet-自动化APC PDU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文