title: Error trying to use a Proxy in Python3
body: <p>I'm trying to visit a url, each time using a different proxy, from a file, until all proxies have been used.  Getting errors:</p>
  
  <pre><code>socket.gaierror: [Errno 11004] getaddrinfo failed
  urllib.error.URLError: &lt;urlopen error [Errno 11004] getaddrinfo failed&gt;
  </code></pre>
  
  <p>proxies1 file has 300 lines like this:
  34.195.146.122:80</p>
  
  <pre><code>import urllib.request
  my_file = open("proxies1","r")
  for n in my_file:
      proxy = urllib.request.ProxyHandler({'http': 'n'})
      opener = urllib.request.build_opener(proxy)
      urllib.request.install_opener(opener)
      urllib.request.urlretrieve('http://www.google.com')
  </code></pre>
  
  <p>Getting the following output:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 1318, in do_open
      encode_chunked=req.has_header('Transfer-encoding'))
    File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 1239, in request
      self._send_request(method, url, body, headers, encode_chunked)
    File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 1285, in _send_request
      self.endheaders(body, encode_chunked=encode_chunked)
    File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 1234, in endheaders
      self._send_output(message_body, encode_chunked=encode_chunked)
    File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 1026, in _send_output
      self.send(msg)
    File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 964, in send
      self.connect()
    File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 936, in connect
      (self.host,self.port), self.timeout, self.source_address)
    File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\socket.py", line 704, in create_connection
      for res in getaddrinfo(host, port, 0, SOCK_STREAM):
    File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\socket.py", line 743, in getaddrinfo
      for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
  socket.gaierror: [Errno 11004] getaddrinfo failed
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "p3.py", line 12, in &lt;module&gt;
      urllib.request.urlretrieve('http://www.google.com')
    File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 248, in urlretrieve
      with contextlib.closing(urlopen(url, data)) as fp:
    File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 223, in urlopen
      return opener.open(url, data, timeout)
    File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 526, in open
      response = self._open(req, data)
    File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 544, in _open
      '_open', req)
    File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 504, in _call_chain
      result = func(*args)
    File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 1346, in http_open
      return self.do_open(http.client.HTTPConnection, req)
    File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 1320, in do_open
      raise URLError(err)
  urllib.error.URLError: &lt;urlopen error [Errno 11004] getaddrinfo failed&gt;
  </code></pre>