create wi fi qr code generator using python

Solutions on MaxInterview for create wi fi qr code generator using python by the best coders in the world

showing results for - "create wi fi qr code generator using python"
Dario
19 Mar 2016
1import os
2try:
3    import pyqrcode
4    import cv2
5except Exception:
6    os.system("pip install pyqrcode")
7    os.system("pip install opencv-python")
8
9ssid = input("\nEnter WiFi SSID: ")
10authtypes = ["WEP", "WPA", 'nopass', 'nopass']
11authnums = ["1", "2", "3", "", ""]
12print("\nEnter\n1)\tWEP")
13print("2)\tWPA/WPA2")
14print("3)\tNone")
15type = authtypes[authnums.index(input())]
16password = None
17
18imagename = "WIFI QR"
19if type!=None:
20    password = input("\nEnter Wifi password: ")
21
22hidtemp = input("\nIs wifi hidden? enter 1 if yes ")
23if hidtemp==1:
24    hidden = True
25else:
26    hidden=False
27
28wifidata = f'WIFI:T:{type};S:{ssid};P:{password};H:{hidden};;'
29datysvd = pyqrcode.create(wifidata)
30
31datysvd.png(imagename, scale = 10)
32image = cv2.imread(imagename)
33window_name = 'qrcode'
34cv2.imshow(window_name, image)
35cv2.waitKey(0)
36cv2.destroyAllWindows()
37os.remove(imagename)