I am currently using the following set-up to change my ip address in Mac OS X:
from stem import Signal
from stem.control import Controller
with Controller.from_port(port = 9051) as controller:
controller.authenticate()
controller.signal(Signal.NEWNYM)
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.1'
}
proxies = {
"http": "http://127.0.0.1:8118"
}
r_ip = requests.get("http://icanhazip.com", proxies=proxies, headers=headers_tor)
print(r_ip.text)
I first run Tor in my command line, then execute the above. I have noticed that the IP address doesn't change immediately but rather several seconds needs to go by before running the chunk of code above to generate a new ip address. Furthermore, on the terminal page where I am running Tor, it outputs messages like:
Aug 25 04:13:53.000 [notice] Rate limiting NEWNYM request: delaying by 7 second(s)
Is there a way to change the IP address without a lag?