title: "[Errno 111] Connection refused" on Pythonanywhere
body: <p>I am trying to deploy my application on pythonanywhere but I am unable to connect to twitter.</p>
  
  <p>Here is the error that I am getting :-</p>
  
  <pre><code>Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1687, in wsgi_app
  response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1360, in full_dispatch_request
  rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1358, in full_dispatch_request
  rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1344, in dispatch_request
  return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/btpraasta/btp_raasta/runServer.py", line 178, in remainingRequests
  return (str)(getTrend.get_remainingRequests())
  File "/home/btpraasta/btp_raasta/python/getTrend.py", line 20, in get_remainingRequests
  data = get_json(url)
  File "/home/btpraasta/btp_raasta/python/getTrend.py", line 10, in get_json
  connection = urllib.urlopen(url, proxies=proxies)
  File "/usr/lib/python2.7/urllib.py", line 87, in urlopen
  return opener.open(url)
  File "/usr/lib/python2.7/urllib.py", line 208, in open
  return getattr(self, name)(url)
  File "/usr/lib/python2.7/urllib.py", line 437, in open_https
  h.endheaders(data)
  File "/usr/lib/python2.7/httplib.py", line 975, in endheaders
  self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 835, in _send_output
  self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 797, in send
  self.connect()
  File "/usr/lib/python2.7/httplib.py", line 1178, in connect
  self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 571, in create_connection
  raise err
  IOError: [Errno socket error] [Errno 111] Connection refused
  </code></pre>
  
  <p>The code I am trying to run is this :-</p>
  
  <pre><code>proxies = {'http': 'http://proxy.server:3128'}
  connection = urllib.urlopen(url, proxies=proxies)
  data = connection.read()
  </code></pre>
  
  <p>And I am trying to access the following URL :-
      '<a href="https://api.twitter.com/1.1/application/rate_limit_status.json" rel="nofollow">https://api.twitter.com/1.1/application/rate_limit_status.json</a>'</p>
  
  <p>I have a free account on pythonanywhere and verified that the API is whitelisted and I am using the proxy as described by them here (<a href="http://help.pythonanywhere.com/pages/403ForbiddenError" rel="nofollow">http://help.pythonanywhere.com/pages/403ForbiddenError</a>).</p>