connect.py 410 B

1234567891011121314151617181920
  1. #!/usr/bin/env python3
  2. import callUSB;
  3. import os;
  4. import urllib.request;
  5. def connect(ssid, passwd):
  6. os.system('nmcli dev wifi connect {0} password {1}'.format(ssid, passwd));
  7. def check():
  8. try:
  9. urllib.request.urlopen('http://www.ozcanoguz.com', timeout=1);
  10. return True;
  11. except urllib.request.URLError:
  12. return False;
  13. if __name__ == '__main__':
  14. print('please use main.py');