Tor + Urllib2 Python
Tor + Urllib2 Python
我每次访问网站时都尝试使用 tor 获取新 IP:
import socks
import socket
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS4, '127.0.0.1', 9151, True)
socket.socket = socks.socksocket
import urllib2
print urllib2.urlopen("http://almien.co.uk/m/tools/net/ip/").read()
9150、9050端口我也试过了。
我不断收到:
socks.ProxyConnectionError: Error connecting to SOCKS4 proxy 127.0.0.1:9151: [Errno 61] Connection refused
针对不同的情况使用stem package to interact with Tor. Official site have many tutorials,例如:
https://stem.torproject.org/tutorials/to_russia_with_love.html
我每次访问网站时都尝试使用 tor 获取新 IP:
import socks
import socket
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS4, '127.0.0.1', 9151, True)
socket.socket = socks.socksocket
import urllib2
print urllib2.urlopen("http://almien.co.uk/m/tools/net/ip/").read()
9150、9050端口我也试过了。
我不断收到:
socks.ProxyConnectionError: Error connecting to SOCKS4 proxy 127.0.0.1:9151: [Errno 61] Connection refused
针对不同的情况使用stem package to interact with Tor. Official site have many tutorials,例如:
https://stem.torproject.org/tutorials/to_russia_with_love.html