Guest User

Untitled

a guest
Feb 19th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. def main():
  2.  
  3. ai = apiai.ApiAI(CLIENT_ACCESS_TOKEN)
  4. request = ai.text_request()
  5.  
  6. request.lang = 'de' # optional, default value equal 'en'
  7.  
  8. request.session_id = "<SESSION ID, UNIQUE FOR EACH USER>"
  9. request.query = "Hello"
  10. response = request.getresponse()
  11. print (response.read())
  12.  
  13. def getresponse(self):
  14. """Send all data and wait for response.
  15. """
  16.  
  17. if getattr(self._connection, 'sock', None) is None:
  18. self._connect()
  19.  
  20. end = self._prepage_end_request_data()
  21.  
  22. if end is not None:
  23. self.send(end.encode('utf-8'))
  24.  
  25. self._beforegetresponce()
  26.  
  27. return self._connection.getresponse()
Add Comment
Please, Sign In to add comment