我正在尝试使用 Python 2.7 连接到 Tor,但是当我尝试使用 urllib 或 urllib2 访问网站时,它会保留我的正常 IP。(我正在使用 vidalia)(是的,它说 Tor 正在运行)这是我的代码:
import urllib
import TorCtl
password = "" ## your tor password
conn = TorCtl.connect(controlAddr="127.0.0.1", controlPort=9051, passphrase= password) ## Connect to tor
ip = urllib.urlopen('http://hypersource.net78.net/autos/ip.php').read() ## Get IP address
print "ip address: " + str(ip)
TorCtl.Connection.send_signal(conn, "NEWNYM") ## change IP
ip = urllib.urlopen('http://hypersource.net78.net/autos/ip.php').read() ## Get IP address
print "ip address: " + str(ip)
我如何让它连接?