For mac, there is a command line tool called an airport. You can manually configure any wi-fi settings, network card settings, troubleshoot networks, change the security types used in the connection, capture packets in a pcap file, join and leave networks, forget the Wi-Fi network, determine the priorities of routers and networks, see signal strength and interference, etc.
Usually it is here - /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport
You can just enter this for reference.
airport airport -h
Using this and the subprocess together, you can accomplish most of these things in python
medakeshav
source share