I want to operate a WiFi dongle with RaspberryPi, (it's like a CPU without built-in WiFi). I need to write a python script which automatically scan for WiFi networks and a connection need to be automatically established with known SSID and password.
This mean that I need to provide the password for the WiFi network from a file, and the remaining thing is to do the scanning and connecting automatically.
I read a file from the Web which contains WiFi SSID name and password.
I need to write a script which scan and list current networds and match it to the SSID from the file and further to automatically create the connection to this known network.
RaspberryPi OS: Rasbian
Thank you all for your answers i made simple solution like below
def wifiscan():
allSSID = Cell.all('wlan0')
print allSSID # prints all available WIFI SSIDs
myssid= 'Cell(ssid=vivekHome)' # vivekHome is my wifi name
for i in range(len(allSSID )):
if str(allSSID [i]) == myssid:
a = i
myssidA = allSSID [a]
print b
break
else:
print "getout"
# Creating Scheme with my SSID.
myssid= Scheme.for_cell('wlan0', 'home', myssidA, 'vivek1234') # vive1234 is the password to my wifi myssidA is the wifi name
print myssid
myssid.save()
myssid.activate()
wifiscan()