title: requests.exceptions.ConnectionError: HTTPConnectionPool
body: <p>I have a python script like so:</p>
  
  <pre><code>#!/usr/bin/python
  import sys
  import requests
  
  if len(sys.argv) &lt; 2:
          print 'usage: python %s &lt;file-urls&gt;' % (sys.argv[0])
          sys.exit(2)
  
  print '%-15s %20s' % ('URL_PAGE', 'STATUS')
  
  FileName = sys.argv[1]
  InputFile = open(FileName)
  OK = open('ok.txt', 'w+')
  NOK = open('nok.txt', 'w+')
  for url in InputFile:
      status = requests.get(url).status_code
      print '%-15s %15s' % (url.strip(), status)
      if status == 200:
          OK.write('%-15s %15s' % (url.strip(), status) + '\n')
          OK.flush()
      else:
          NOK.write('%-15s %15s' % (url.strip(), status) + '\n')
          NOK.flush()
  OK.close()
  NOK.close()
  </code></pre>
  
  <p>When I run it the following error accurs:</p>
  
  <pre><code>Traceback (most recent call last):
    File "url-code.py", line 18, in &lt;module&gt;
      status = requests.get(url).status_code
    File "/usr/lib/python2.7/dist-packages/requests/api.py", line 55, in get
      return request('get', url, **kwargs)
    File "/usr/lib/python2.7/dist-packages/requests/api.py", line 44, in request
      return session.request(method=method, url=url, **kwargs)
    File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 383, in request
      resp = self.send(prep, **send_kwargs)
    File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 486, in send
      r = adapter.send(request, **kwargs)
    File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 378, in send
      raise ConnectionError(e)
  requests.exceptions.ConnectionError: HTTPConnectionPool(host='google.com%0A', port=80): Max retries exceeded with url: / (Caused by &lt;class 'socket.gaierror'&gt;: [Errno -2] Name or service not known)
  </code></pre>
  
  <p>What is it and how can I deal with it and resolve it?</p>