Failed to establish a new connection: [Errno 11001] getaddrinfo failed

Hello all. I'm using requests 2.8.1 as part of a Flask 0.10.1 installation with Python 3.4 on Windows 8.1, and getting the following traceback upon attempting to run my code:

```
File "c:\Python34\atweather\lib\site-packages\requests-2.8.1-py3.4.egg\requests\api.py", line 69, in get return request('get', url, params=params, **kwargs)
File "c:\Python34\atweather\lib\site-packages\requests-2.8.1-py3.4.egg\requests\api.py", line 50, in request response = session.request(method=method, url=url, **kwargs)
File "c:\Python34\atweather\lib\site-packages\requests-2.8.1-py3.4.egg\requests\sessions.py", line 468, in request resp = self.send(prep, **send_kwargs)
File "c:\Python34\atweather\lib\site-packages\requests-2.8.1-py3.4.egg\requests\sessions.py", line 576, in send r = adapter.send(request, **kwargs)
File "c:\Python34\atweather\lib\site-packages\requests-2.8.1-py3.4.egg\requests\adapters.py", line 423, in send raise ConnectionError(e, request=request)

requests.exceptions.ConnectionError: HTTPConnectionPool(host='proxy.server', port=3128): Max retries exceeded with url: http://forecast.weather.gov/MapClick.php?lon=-84.2476&lat=34.5627&unit=0&lg=english&FcstType=text&TextType=1 (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x036F3830>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',)))
```

It's not an issue with the url that I'm passing in, as the url works fine when I enter it directly into a browser tab - and moreover the same issue crops up with any url, for instance http://google.com.

My website is very simple and I'm just attempting to run it locally to do some development on it. I'm fairly new to using Flask and web programming in general, so if this seems more like something that I'm doing wrong with my Flask environment, directory structure, etc. then I apologize. Nothing has really changed about my project since the last time I did local development on it except for the versions of various packages that Flask uses. 

Also...I chopped off everything in the traceback prior to when it started throwing "requests" stuff at me, but if you think any of what I excluded could be helpful then let me know. Thank you.


Hey @patjones80,

Can you try doing

``` py
>>> import socket
>>> s = socket.socket()
>>> s.connect(('www.google.com', 80))
```

To see what happens?


Oh, I just noticed this snippet from your issue:

```
HTTPConnectionPool(host='proxy.server', port=3128)
```

Do you have proxies properly configured?


I'm not sure to be honest. I can say for sure that I have never done anything with them to begin with. 


@patjones80 It seems like you have some environment variables set up here. In your deployed environment, can you run `echo "$HTTP_SERVER"` for me please?

Requests will normally look for environment variables that tell processes to use proxies. It seems like you have one set here.


HTTP_SERVER is not set.


Oh I'm sorry, I had clearly lost my mind. `echo "$HTTP_PROXY"` please. =)


No problem! That isn't set either, which I checked both at a DOS command line and from within IDLE.


Hmmmm.

Can you try opening a Python shell and running this?

``` python
>>> import requests
>>> r = requests.get('http://http2bin.org/get')
```


The problem was in my views.py file. The line 

```
page = requests.get(url, proxies = {'http':'http://proxy.server:3128'})
```

should just be

```
page = requests.get(url)
```

I think that proxy 3128 is necessary for the server (pythonanywhere) that hosts my website, and I just forgot to remove it from my local code. Thanks!


Thanks for updating us @patjones80 


@patjones80 could you please tell me which views.py? I am new to this and I am getting a similar error MaxRetryError: HTTPConnectionPool(host='w.x.y.z', port=5000):


@wjdan94 I'm not sure that I understand your question. If your problem is the same as mine, then your port number is either incorrect or just doesn't need to be specified. In my case, it did not need to be specified since I was working in my local development environment.


your system is running behind a proxy which is not allowing it. Try to set the settings of proxy to that of google's

after running  _echo "$HTTP_SERVER"_ I got _"$HTTP_SERVER"_

@5ai92 My system does run behind a proxy which is XX-net. How can I fix that

Hi,
@patjones80 
Does this views.py file exist in request library folder? Could you please let me know where to change the settings to bypass proxy as I am also getting proxy issues .