title: How to disable ssl verification for text_request() of api.ai / dialogflow
body: <p>The python client of api.ai/dialogflow provides a method for sending queries and get responses through text_request(). Here's the code block</p>
  
  <pre><code>def main():
  
      ai = apiai.ApiAI(CLIENT_ACCESS_TOKEN)
      request = ai.text_request()
  
      request.lang = 'de'  # optional, default value equal 'en'
  
      request.session_id = "&lt;SESSION ID, UNIQUE FOR EACH USER&gt;"
      request.query = "Hello"
      response = request.getresponse()
      print (response.read())  
  </code></pre>
  
  <p>But the thing is <code>text_request()</code> uses <em>HTTPSConnection class</em> for sending requests which is incompatible with my master server page's <em>HTTPS</em> connection.  As, I have to use websocket and I am invoking api.ai request within my main <code>server.py</code> which is served by <em>uWSGI</em> server served with self signed ssl certificate for the <em>HTTPS</em> connection.</p>
  
  <p>So, calling <code>text_request()</code> in <em>HTTPS</em> connection with self signed ssl giving me following error,</p>
  
  <blockquote>
    <p>file "server.py", line 84, in chat_message
        response = request.getresponse()   File "/home/user/uwsgi_Test/virtual_frame/lib/python3.5/site-packages/apiai/requests/request.py",
    line 128, in getresponse
        self._connect()   File "/home/user/uwsgi_Test/virtual_frame/lib/python3.5/site-packages/apiai/requests/request.py",
    line 82, in _connect
        self._connection.connect()</p>
  </blockquote>
  
  <p>Here's the <code>getresponse()</code> method from <a href="https://github.com/dialogflow/dialogflow-python-client/blob/master/apiai/requests/request.py" rel="nofollow noreferrer"><code>request.py</code></a> </p>
  
  <pre><code>def getresponse(self):
          """Send all data and wait for response.
          """
  
          if getattr(self._connection, 'sock', None) is None:
              self._connect()
  
          end = self._prepage_end_request_data()
  
          if end is not None:
              self.send(end.encode('utf-8'))
  
          self._beforegetresponce()
  
          return self._connection.getresponse()
  </code></pre>
  
  <p>Whereas it's working fine for HTTP requests. </p>
  
  <p>So, in that case, I think there's two ways out to resoleve:</p>
  
  <p>1) <code>text_request()</code> will not check for the security certificate at all. Something like in the python requests <code>verify = False</code> -</p>
  
  <blockquote>
    <p>requests.get('<a href="https://kennethreitz.com" rel="nofollow noreferrer">https://kennethreitz.com</a>', verify=False) </p>
  </blockquote>
  
  <p>2) Sending the self signed certificates as a parameter to text_request(). So, while sending requests and getting response security certificate could be verified with the certificate file I would be sending. </p>
  
  <p>How could I actually extend the <code>send_text()</code> method as above. Or, is there any  support of disable ssl verification from api.ai python client itself? </p>