After reading through the other questions on StackOverflow, I got a snippet of Python code that is able to make requests through a Tor proxy:
import urllib2
proxy = urllib2.ProxyHandler({'http':'127.0.0.1:8118'})
opener = urllib2.build_opener(proxy)
print opener.open('https://check.torproject.org/').read()
Since Tor works fine in Firefox with TorButton, I expected it to work fine in Python. Unfortunately, included in the mess of HTML: Sorry. You are not using Tor
. I am not sure why this is the case or how to get Tor working properly with urllib2
.