title: Python Flask With Requests Module
body: <p>I am using a Python server to make a http call with Python's Requests module. The requests call works with no issues in a regular python shell. But in Flask, it errors out with "raise ConnectionError(e)".  This really hurts because I need to make the url call on the back end with python since I can't with javascript because of cross-origin restrictions. </p>
  
  <pre><code>flask python # cat myapp.py
  import json
  import requests
  from flask import Flask
  app = Flask(__name__)
  
  
  @app.route('/', defaults={'path': ''}, methods=('GET', 'POST'))
  @app.route('/&lt;path:path&gt;', methods=('GET', 'POST'))
  def catch_all(path):
      link = "http://10.44.11.33/api/v1/counts/latest/15"
      r = requests.get(link)
      return "Hello World"
  
  
  if __name__ == '__main__':
      app.run(debug=True, host="0.0.0.0")
  </code></pre>
  
  <p>Error output: </p>
  
  <pre><code>File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1836, in __call__
  return self.wsgi_app(environ, start_response)
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
  response = self.make_response(self.handle_exception(e))
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
  reraise(exc_type, exc_value, tb)
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
  response = self.full_dispatch_request()
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
  rv = self.handle_user_exception(e)
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
  Display the sourcecode for this frameOpen an interactive python shell in this framereraise(exc_type, exc_value, tb)
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
  rv = self.dispatch_request()
  File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
  return self.view_functions[rule.endpoint](**req.view_args)
  File "/python/myapp.py", line 13, in catch_all
  r = requests.get(core_link)
  File "/usr/lib64/python2.7/site-packages/requests/api.py", line 55, in get
  return request('get', url, **kwargs)
  File "/usr/lib64/python2.7/site-packages/requests/api.py", line 44, in request
  return session.request(method=method, url=url, **kwargs)
  File "/usr/lib64/python2.7/site-packages/requests/sessions.py", line 335, in request
  resp = self.send(prep, **send_kwargs)
  File "/usr/lib64/python2.7/site-packages/requests/sessions.py", line 438, in send
  r = adapter.send(request, **kwargs)
  File "/usr/lib64/python2.7/site-packages/requests/adapters.py", line 327, in send
  raise ConnectionError(e)
  </code></pre>