It may be because of my ISP provider, sometimes when I am away, internet is down and it doesn't work until I restart wifi connection. So my script begins to raise timeout exception until I turn off and then turn on the wifi connection. Is there a efficent way to turn wifi on/off automatically with python 2.7 on osx el capitan?
SOLUTION:
The easier and more efficent way to do this without using any complex or subprocess module:
import os
os.system("networksetup -setairportpower airport off")
os.system("networksetup -setairportpower airport on")
Thanks to Hackaholic
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With