需要在程式中連接vpn, 部分代碼如下
connect_cmd = f'vpncli connect {vpn}'
p = Popen(connect_cmd, shell=True, text=True, stdin=PIPE, stdout=PIPE, stderr=PIPE)經檢驗, 確實出現了請輸入密碼的資訊. 下一步, 需要輸入密碼, 網上的資料表明用
out, err = p.communicate(input='0\n')
可以和行程進行互動, 但我運行后, 總是卡在那里. 不知是用法有誤還是其他問題, 望有經驗的指導一下. 或者有沒有其他解決方案.
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/262235.html
