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 + "\n")
self.logger.info("Entering APC Password")
telnet_session.read_until("Password :")
telnet_session.write(self.apc_password + "\n")
sleep(2)
print telnet_session.read_all()
I'm running windows so I believe that https://github.com/quackenbush/APC is not an option as I cannot install pexpect.
Any help would be appreciated.
Thanks,
Parth