title: Connecting to the Tor network with Python without getting "Proxy server is refusing connection"
body: <p>I've been trying to use Tor via Python only to come across the "Proxy server is refusing connection" error.</p>
  
  <p>I've trying this method using the Stem library:
  <a href="http://www.thedurkweb.com/automated-anonymous-interactions-with-websites-using-python-and-tor/" rel="nofollow">http://www.thedurkweb.com/automated-anonymous-interactions-with-websites-using-python-and-tor/</a></p>
  
  <p>Any help to fixing this error? </p>
  
  <p>Here is the code:</p>
  
  <pre><code>import stem.process
  from stem import Signal
  from stem.control import Controller
  from splinter import Browser
  
  proxyIP = "127.0.0.1"
  proxyPort = 9150
  
  proxy_settings = {"network.proxy.type":1,
      "network.proxy.ssl": proxyIP,
      "network.proxy.ssl_port": proxyPort,
      "network.proxy.socks": proxyIP,
      "network.proxy.socks_port": proxyPort,
      "network.proxy.socks_remote_dns": True,
      "network.proxy.ftp": proxyIP,
      "network.proxy.ftp_port": proxyPort
  }
  browser = Browser('firefox', profile_preferences=proxy_settings)
  
  def interactWithSite(browser):
      browser.visit("http://dogdogfish.com/python-2/generating-b2b-sales-data-in-python/")
      browser.fill("comment", "But the thing is... Why would anyone ever want to do this? I must have thought that times...")
      browser.fill("author", "Pebblor El Munchy")
      browser.fill("email", "barack@tehwhitehouz.gov")
      browser.fill("url", "https://upload.wikimedia.org/wikipedia/en/1/16/Drevil_million_dollars.jpg")
      button = browser.find_by_name("submit")
      button.click()
  
  interactWithSite(browser)
  </code></pre>