()
| 12 | |
| 13 | |
| 14 | def main(): |
| 15 | # Exit early if no sessions with my_username are found. |
| 16 | if not any(s.startswith(b'my_username ') for s in sh('who').split(b'\n')): |
| 17 | return |
| 18 | |
| 19 | time.sleep(17) |
| 20 | |
| 21 | conn = telnetlib.Telnet(host=COFFEE_MACHINE_ADDR) |
| 22 | conn.open() |
| 23 | conn.expect([COFFEE_MACHINE_PROM]) |
| 24 | conn.write(COFFEE_MACHINE_PASS) |
| 25 | |
| 26 | conn.write('sys brew') |
| 27 | time.sleep(24) |
| 28 | |
| 29 | conn.write('sys pour') |
| 30 | conn.close() |
| 31 | |
| 32 | |
| 33 | if __name__ == '__main__': |