title: HTTPSConnectionPool Max retries exceeded
body: <p>I've got a django app in production running on nginx/uwsgi. We recently started using SSL for all our connections. Since moving to SSL, I often get the following message:</p>
  
  <pre><code>HTTPSConnectionPool(host='foobar.com', port=443): 
      Max retries exceeded with url: /foo/bar
  </code></pre>
  
  <p>Essentially what happens is I've got the browser communicating with django server code, which then uses the requests library to call an api. Its the connection to the api that generates the error. Also, I've moved all our requests into one session (a requests session, that is), but this hasn't helped.</p>
  
  <p>I've bumped up the number of uwsgi listeners since I thought that could be the problem, but our load isn't that high. Also, we never had this problem before SSL. Does anyone have some advice as to how to solve this problem?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Code snippet of how I call the API. I've posted it (mostly) verbatim. Note its not the code that actually fails, but the requests library that throws an exception when calling <code>self.session.post</code></p>
  
  <pre><code>def save_answer(self):
      logger.info("Saving answer to question")
      url = "%s1.0/exam/learneranswer/" % self.api_url
      response = {'success': False}
  
      data = {'questionorder': self.request.POST.get('questionorder'),
              'paper': self.request.POST.get('paper')}
      data['answer'] = ",".join(self.request.POST.getlist('answer'))
      r = self.session.post(url, data=simplejson.dumps(data))
      if r.status_code == 201:
          logger.info("Answer saved successfully")
          response['success'] = True
      elif r.status_code == 400:
          if r.text == "Paper expired":
              logger.warning("Timer has expired")
              response['message'] = 'Your time has run out'
          if r.text == "Question locked":
              response['message'] = \
                  'This question is locked and cannot be answered anymore'
          else:
              logger.error("Unknown error")
              self.log_error(r, "Unknown Error while saving answer")
      else:
          logger.error("Internal error")
          self.log_error(r, "Internal error in api while saving answer")
      return simplejson.dumps(response)
  </code></pre>