title: httplib.ResponseNotReady with api.ai
body: <p>I am trying to make my own chatbot with api.ai.</p>
  
  <p>The first time it goes good but then the second time I get this error: </p>
  
  <pre><code>   Traceback (most recent call last):
    File "/root/Documents/Projects/Darlene/core/api.py", line 34, in &lt;module&gt;
      main()
    File "/root/Documents/Projects/Darlene/core/api.py", line 28, in main
      speech, action = b.handle(cmd)
    File "/root/Documents/Projects/Darlene/core/api.py", line 15, in handle
      response = self.request.getresponse().read()
    File "/usr/local/lib/python2.7/dist-packages/apiai/requests/request.py", line 133, in getresponse
      return self._connection.getresponse()
    File "/usr/lib/python2.7/httplib.py", line 1123, in getresponse
      raise ResponseNotReady()
  httplib.ResponseNotReady
  </code></pre>
  
  <p>It looks like there is a problem with the api or so. But I am not sure. 
  Here is my code: </p>
  
  <pre><code>import apiai
  import json
  
  
  
  class Bot(object):
      def __init__(self, client_token='&lt;clientToken&gt;'):
  
          self.AI = apiai.ApiAI(client_token)
          self.request = self.AI.text_request()
          self.request.lang = 'en'
  
      def handle(self, text):
          self.request.query = text
          response = self.request.getresponse().read()
          speech = str(json.loads(response)['result']['fulfillment']['speech'])
          action = str(json.loads(response)['result']['action'])
          if action is not '':
              return speech, action
          else:
              return speech, None
  
  
  def main():
      b = Bot()
      while True:
          cmd = raw_input('me; ')
          speech, action = b.handle(cmd)
          print speech
          if action is not None:
              print 'action'
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>Does anyone know a way to fix this?</p>