title: Python requests.exceptions.ConnectionError: HTTPSConnectionPool : Max retries exceeded with url: [Errno 111] Connection refused)
body: <p>So I am trying to use an API (<a href="http://twittercounter.com/pages/api" rel="nofollow">http://twittercounter.com/pages/api</a>) to get some data from the net. While using my API key direcly via browser, I am getting the required results. But on using requests.get() function in python, I am getting an error, the traceback is given here.</p>
  
  <p>code:</p>
  
  <pre><code>&gt;&gt;&gt; import requests
  &gt;&gt;&gt; r = requests.get('https://api.twittercounter.com/?apikey=XXXX&amp;twitter_id=57947109')
  </code></pre>
  
  <p>traceback:</p>
  
  <pre><code> File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/usr/lib/python2.7/site-packages/requests/api.py", line 55, in get
      return request('get', url, **kwargs)
    File "/usr/lib/python2.7/site-packages/requests/api.py", line 44, in request
      return session.request(method=method, url=url, **kwargs)
    File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 382, in request
      resp = self.send(prep, **send_kwargs)
    File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 485, in send
      r = adapter.send(request, **kwargs)
    File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 372, in send
      raise ConnectionError(e)
  requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.twittercounter.com', port=443): Max retries exceeded with url: /?apikey=XXXX&amp;twitter_id=57947109 (Caused by &lt;class 'socket.error'&gt;: [Errno 111] Connection refused)
  </code></pre>
  
  <p>I made about 10 connections with this key, and the rate limit is 100, so I am sure I am not exceeding the limit. Can anyone please help. I am pretty much a noob with requests and http.</p>
  
  <p>EDIT: Tried to set browser agent in the request headers</p>
  
  <p>I tried this to change the browser agent, and it still does not work</p>
  
  <pre><code>&gt;&gt;&gt; headers = {
  ...     'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0'}
  &gt;&gt;&gt; url = 'https://api.twittercounter.com/?apikey=09792d72d848c55a5b6b9a1bf3bb225a&amp;twitter_id=57947109'
  &gt;&gt;&gt; response = requests.get(url, headers=headers)
  </code></pre>
  
  <p>Am getting the same traceback as last time.</p>