0

Stem officials docs says that new identity is established by the following:

from stem import Signal
from stem.control import Controller

with Controller.from_port(port = 9051) as controller:
    controller.authenticate()
    controller.signal(Signal.NEWNYM) 

And below is my code:

import urllib2

from stem import Signal
from stem.control import Controller

def connect():
    with Controller.from_port(port=9051) as controller:
        controller.authenticate(my_pass)  
        controller.signal(Signal.NEWNYM)

for i in range(5):
    connect()
    print urllib2.urlopen('http://icanhazip.com/').read().strip()

However the ip address does not change.

ps. Yes, I've edited the torrc file.

p2. I am aware of this and that threads.

Any ideas?

Community
  • 1
  • 1
Bartek R.
  • 441
  • 1
  • 8
  • 15

1 Answers1

3

you will have to wait until a new nym is available: if controller.is_newnym_available(): controller.signal(Signal.NEWNYM)

Einstein
  • 431
  • 1
  • 5
  • 12