I wrote a small script for scraping some data. Unfortunately i get blocked after a certain amount of requests. Since i have a VPN client running (VPNExpress & Mac) i make a manual reconnect to the VPN client, get a new IP and keep scraping.
Is there any simple way to force my client to reconnect on its own out of a python script? E.g. turn WiFi off and on again:
import os
os.system("networksetup -setairportpower airport off")
os.system("networksetup -setairportpower airport on")
Thought there is maybe a better way to do this? Like "blocking" the connection to force the vpn client to reconnect?