title: Timing out when I use a proxy
body: <p>I am trying to implement proxies into my web crawler. Without the proxies, my code has no problem connecting to the website, however when I try to add in proxies, suddenly it won't connect! It doesn't look like anybody in python-requests has made a post about this problem, so I'm hoping you all can help me!</p>
  
  <p>Background info: I'm using a Mac and using Anaconda's Python 3.4 inside of a virtual environment. </p>
  
  <p>Here is my code that works without proxies</p>
  
  <pre><code>proxyDict = {'http': 'http://10.10.1.10:3128'}
  
  def pmc_spider(max_pages, pmid): 
      start = 1
  
      titles_list = []
      url_list = []
      url_keys = []
  
      while start &lt;= max_pages:
          url = 'http://www.ncbi.nlm.nih.gov/pmc/articles/pmid/'+str(pmid)+'/citedby/?page='+str(start)
  
          req = requests.get(url) #this works
          plain_text = req.text
          soup = BeautifulSoup(plain_text, "lxml")
  
          for items in soup.findAll('div', {'class': 'title'}):
              title = items.get_text()
              titles_list.append(title)
  
              for link in items.findAll('a'):
                  urlkey = link.get('href')
                  url_keys.append(urlkey)   #url = base + key
                  url =  "http://www.ncbi.nlm.nih.gov"+str(urlkey)
                  url_list.append(url)
  
          start += 1
      return titles_list, url_list, authors_list
  </code></pre>
  
  <p>Based on other posts I'm looking at, I should just be able to replace this:</p>
  
  <pre><code>req = requests.get(url)
  </code></pre>
  
  <p>with this:</p>
  
  <pre><code>req = requests.get(url, proxies=proxyDict, timeout=2)
  </code></pre>
  
  <p>But this doesn't work! :( If I run it with this line of code the terminal gives me a TimeOut error</p>
  
  <pre><code>socket.timeout: timed out
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
  File "/Users/hclent/anaconda3/envs/py34/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 578, in urlopen
  chunked=chunked)
  File "/Users/hclent/anaconda3/envs/py34/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 362, in _make_request
  conn.request(method, url, **httplib_request_kw)
  File "/Users/hclent/anaconda3/envs/py34/lib/python3.4/http/client.py", line 1137, in request
  self._send_request(method, url, body, headers)
  File "/Users/hclent/anaconda3/envs/py34/lib/python3.4/http/client.py", line 1182, in _send_request
  self.endheaders(body)
  File "/Users/hclent/anaconda3/envs/py34/lib/python3.4/http/client.py", line 1133, in endheaders
  self._send_output(message_body)
  File "/Users/hclent/anaconda3/envs/py34/lib/python3.4/http/client.py", line 963, in _send_output
  self.send(msg)
  File "/Users/hclent/anaconda3/envs/py34/lib/python3.4/http/client.py", line 898, in send
  self.connect()
  File "/Users/hclent/anaconda3/envs/py34/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 167, in connect
  conn = self._new_conn()
  File "/Users/hclent/anaconda3/envs/py34/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 147, in _new_conn
  (self.host, self.timeout))
  requests.packages.urllib3.exceptions.ConnectTimeoutError:       (&lt;requests.packages.urllib3.connection.HTTPConnection object at 0x1052665f8&gt;, 'Connection to 10.10.1.10 timed out. (connect timeout=2)')
  </code></pre>
  
  <p>And then I get a few of these printed in the terminal with different traces but the same error:</p>
  
  <pre><code> During handling of the above exception, another exception occurred:
  Traceback (most recent call last):
    File "/Users/hclent/anaconda3/envs/py34/lib/python3.4/site-packages/requests/adapters.py", line 403, in send
  timeout=timeout
   File "/Users/hclent/anaconda3/envs/py34/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 623, in urlopen
  _stacktrace=sys.exc_info()[2])
  File "/Users/hclent/anaconda3/envs/py34/lib/python3.4/site-packages/requests/packages/urllib3/util/retry.py", line 281, in increment
  raise MaxRetryError(_pool, url, error or ResponseError(cause))
  requests.packages.urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='10.10.1.10', port=3128): Max retries exceeded with url: http://www.ncbi.nlm.nih.gov/pmc/articles/pmid/18269575/citedby/?page=1 (Caused by ConnectTimeoutError(&lt;requests.packages.urllib3.connection.HTTPConnection object at 0x1052665f8&gt;, 'Connection to 10.10.1.10 timed out. (connect timeout=2)'))
  </code></pre>
  
  <p>Why would the addition of proxies to my code suddenly cause me to timeout? I tried it on several random urls and had the same thing happen. So it seems to be a problem with proxies rather than a problem with my code. However, I'm at the point where I MUST use proxies now so I need to get to the root of this and fix it. I've also tried several different IP addresses for the proxy from a VPN that I use, so I know the IP addresses are valid.</p>
  
  <p>I appreciate your help so much! Thank you!</p>