title: Python: How to access a list of urls through a list of proxies?
body: <p>Right now I have this code tenatively:</p>
  
  <pre><code>import json
  import urllib2  
  
  with open('proxies.txt') as proxies:
      for line in proxies:
          proxy = json.loads(line)
          proxy_handler = urllib2.ProxyHandler(proxy)
          opener = urllib2.build_opener(proxy_handler)
          urllib2.install_opener(opener)
  with open('urls.txt') as urls:
      for line in urls:
          url = line.rstrip()
          data = urllib2.urlopen(url).read()
          print data
  </code></pre>
  
  <p>my proxies.txt file is as follows: </p>
  
  <pre><code>{"https": "https://94.142.27.4:3128"}
  {"http": "http://118.97.95.174:8080"}
  {"http": "http://66.62.236.15:8080"}
  </code></pre>
  
  <p>and my urls.txt file is as follows: </p>
  
  <pre><code>http://www.google.com
  http://www.facebook.com
  http://www.reddit.com
  </code></pre>
  
  <p>It seems that it is installing all proxies and then processing each url in the list with all of the proxies installed. What I really want though, is for it to access each url through each proxy individually. So</p>
  
  <ol>
  <li>access url1 through proxy 1</li>
  <li>access url2 through proxy 1</li>
  <li>access url3 through proxy 1</li>
  <li>access url1 through proxy 2</li>
  <li>access url2 through proxy 2</li>
  <li>access url3 through proxy 2</li>
  <li>access url1 through proxy 3</li>
  <li>access url2 through proxy 3</li>
  <li>access url3 through proxy 3</li>
  </ol>
  
  <p>is there a way to do this? Is it already doing this? Am I misunderstanding what a proxy really is? Am I misunderstanding what install_opener really does?</p>