2

I am running python 2.5.1 and Tor 0.2.2.34 on OSX 10.5
I have checked the SOCKS question and the Trying to get Tor to work with Python question and the Tor with Python question and have tried them all, and a combination of the above, while running Tor in the background and none have worked really. If I try the "Tor with Python" way (just urllib2) the script works, but my IP goes unchanged when checked by reading and printing the source code on a whatsmyip page in the same way through Python.

this is the script I'm trying to run through Tor:

import socks
import socket

socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 8118)
socket.socket = socks.socksocket

import urllib2
web_page = "http://www.cartage.org.lb/en/themes/arts/architec/architecturalstructure/LookingforLiminality/LookingforLiminality.htm"

req = urllib2.Request(web_page)
response = urllib2.urlopen(req)
the_page = response.read()
matches = re.findall('Gianni Vattimo', the_page)
if len(matches) == 0:
    print 'RESULTS!'
else:
    print 'There were NO results!'

(the web page is just an example and not my actual target obv.)
When I run this script it just stalls in Terminal for an indefinite amount of time. As I said, I've tried different renditions, changing the port to other suggestions, etc, but nothing has worked. Any suggestions or tested fixes?

Thank you.

Community
  • 1
  • 1
Gronk
  • 381
  • 1
  • 3
  • 12

0 Answers0