How do I get Python to know what Wifi the user is connected to?
For Mac OS query the airport using os
module.
"/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I"
Then, look the name assigned to SSID
by your school.
It should be something similar for the other operating systems.
here some code that actually works, the other answers did not work for me on Windows...
import subprocess
wifi = subprocess.check_output(['netsh', 'WLAN', 'show', 'interfaces'])
data = wifi.decode('utf-8')
if "school_wifi_name" in data:
print("connected to speccific wifi")
else:
print("not connected")
import subprocess
if "SchoolWifiName" in subprocess.check_output("netsh wlan show interfaces"):
print "I am on school wifi!"