ConnectionError: HTTPConnectionPool( Max retries exceeded with url) [Errno -2] Name or service not known

Hey,guys!
Maybe I did not ask the right place,i follow this project:[https://github.com/jiehua233/phoneregion](https://github.com/jiehua233/phoneregion),then run command 'python main.py --scrapy',but always get error like this:
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/gevent/greenlet.py", line 534, in run
    result = self._run(_self.args, *_self.kwargs)
  File "/home/zjhxmjl/Documents/phoneregion/scrapy.py", line 55, in worker
    info = self.validate(phone)
  File "/home/zjhxmjl/Documents/phoneregion/scrapy.py", line 62, in validate
    r = requests.get(url)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, *_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, *_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 475, in request
    resp = self.send(prep, *_send_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 596, in send
    r = adapter.send(request, *_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 487, in send
    raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='www.ip138.com', port=8080): Max retries exceeded with url: /search.asp?mobile=1459626&action=mobile (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x14663d0>: Failed to establish a new connection: [Errno -2] Name or service not known',))
<Greenlet at 0x140d0f0: <bound method Scrapy.worker of <scrapy.Scrapy instance at 0x12dcf38>>(['1450000', '1450001', '1450002', '1450003', '1450)> failed with ConnectionError
i check the number "1459626" from  [here](http://www.ip138.com:8080/search.asp?mobile=1459626&action=mobile) which i need but can't store in the file "phonenum.dat",thks for advance. 


this is requirements.txt which i had install
[requirements.txt](https://github.com/kennethreitz/requests/files/455358/requirements.txt)


This error says that we are unable to resolve the domain name `www.ip138.com`. Can you confirm that that domain name is valid?


@Lukasa thks for reply,i confirm the domain name is valid,because i can get some datas.but sometimes i get the error "ConnectionError".
**some error info:**
`[zjhxmjl@localhost phoneregion]$ python main.py --scrapy > log.txt
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/gevent/greenlet.py", line 534, in run
    result = self._run(_self.args, *_self.kwargs)
  File "/home/zjhxmjl/Documents/phoneregion/scrapy.py", line 55, in worker
    info = self.validate(phone)
  File "/home/zjhxmjl/Documents/phoneregion/scrapy.py", line 62, in validate
    r = requests.get(url)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, *_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, *_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 475, in request
    resp = self.send(prep, *_send_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 596, in send
    r = adapter.send(request, *_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 487, in send
    raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='www.ip138.com', port=8080): Max retries exceeded with url: /search.asp?mobile=1459772&action=mobile (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x3970d90>: Failed to establish a new connection: [Errno -2] Name or service not known',))
<Greenlet at 0x31ae0f0: <bound method Scrapy.worker of <scrapy.Scrapy instance at 0x307ef38>>(['1450000', '1450001', '1450002', '1450003', '1450)> failed with ConnectionError

Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/gevent/greenlet.py", line 534, in run
    result = self._run(_self.args, *_self.kwargs)
  File "/home/zjhxmjl/Documents/phoneregion/scrapy.py", line 55, in worker
    info = self.validate(phone)
  File "/home/zjhxmjl/Documents/phoneregion/scrapy.py", line 62, in validate
    r = requests.get(url)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, *_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, *_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 475, in request
    resp = self.send(prep, *_send_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 596, in send
    r = adapter.send(request, *_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 487, in send
    raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='www.ip138.com', port=8080): Max retries exceeded with url: /search.asp?mobile=1459728&action=mobile (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x34df390>: Failed to establish a new connection: [Errno -2] Name or service not known',))
<Greenlet at 0x31aef50: <bound method Scrapy.worker of <scrapy.Scrapy instance at 0x307ef38>>(['1450000', '1450001', '1450002', '1450003', '1450)> failed with ConnectionError

Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/gevent/greenlet.py", line 534, in run
    result = self._run(_self.args, *_self.kwargs)
  File "/home/zjhxmjl/Documents/phoneregion/scrapy.py", line 55, in worker
    info = self.validate(phone)
  File "/home/zjhxmjl/Documents/phoneregion/scrapy.py", line 62, in validate
    r = requests.get(url)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, *_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, *_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 475, in request
    resp = self.send(prep, *_send_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 596, in send
    r = adapter.send(request, *_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 487, in send
    raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='www.ip138.com', port=8080): Max retries exceeded with url: /search.asp?mobile=1459727&action=mobile (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x361c210>: Failed to establish a new connection: [Errno -2] Name or service not known',))
<Greenlet at 0x306b4b0: <bound method Scrapy.worker of <scrapy.Scrapy instance at 0x307ef38>>(['1450000', '1450001', '1450002', '1450003', '1450)> failed with ConnectionError`

**this is log.txt**
[log.txt](https://github.com/kennethreitz/requests/files/455727/log.txt)


So that exception means that the DNS lookup has failed. There's very little we can do about that other than simply to retry, so I recommend adding some error handling around that block.


We just saw this with multiple domains at the same time on 2 different servers on the same network.  The weird thing is that all other processes could connect to the domains without any problem and DNS was working fine at the time we attempted to diagnose this.  The above error continued until the process was restarted it, it did not recover even when we knew the DNS was working properly.  I'm guessing somewhere either in requests or python that the failed DNS lookup was cached and it never attempted to resolve the domain again.

So, Requests does not cache DNS lookups. That means that this must be a Python or OS level issue.

When i tried to configure HTTP/HTTPS proxy for iPython notebook server  i am getting error like below. No idea what to do. Any help is appreciated. 

ProxyError: HTTPConnectionPool(host='proxy.example.com', port=80): Max retries exceeded with url: http://google.com/ (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0B9B95D0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',)))