1

I would like to change my id in tor with mechanize

Thats what I got right now:

import socks
import socket
import mechanize
from mechanize import Browser

def create_connection(address, timeout=None, source_address=None):
    sock = socks.socksocket()
    sock.connect(address)
    return sock

socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9050)


for i in range(0, 10):
    socket.socket = socks.socksocket
    socket.create_connection = create_connection
    br = Browser()
    print br.open('http://icanhazip.com').read()

How can I change my id everytime I request to the site?

Thank you in advance!

Lucas
  • 154
  • 1
  • 12

0 Answers0