def connectToUserWifi():
try:
child = pexpect.spawn('sudo wifi autoconnect')
child.expect('Connecting *')
time.sleep(20)
except:
response = requests.get('http://joedye.me/pi-order/config').json()
response = json.loads(response)
deleteUserWifiIfPresent()
child = pexpect.spawn('sudo wifi connect --ad-hoc ' + response['wifi-network'])
child.expect('passkey>')
child.sendline(str(response['wifi-password']))
childForAdd = pexpect.spawn('sudo wifi add userWifi '+ response['wifi-network'])
childForAdd.expect('passkey>')
childForAdd.sendline(str(response['wifi-password']))
time.sleep(30)
#print(response['wifi-network'])
#print(response['wifi-password'])
评论列表
文章目录