Using the Conversation class in our server

To integrate the Conversation class with our flask server, we need to create some endpoints that will call its methods. Since the Conversation class needs a database passed in, we will also have to deduce which database we are writing to in our endpoints.

The following naming conventions will be used for our databases:

  • Take the username of the author
  • Take the username of the person receiving the message
  • Arrange them alphabetically
  • Join them with an underscore
  • Add .db as the file extension

When we name our database as such, we will only have one database per two people conversing. Arranging the names alphabetically when determining the database to use ensures that it doesn't matter which user opens ...

Get Tkinter GUI Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.