April 2018
Beginner
340 pages
7h 54m
English
When the user opens up a chat window with a friend, our Requester will need to contact the web server to retrieve the conversation history. If there is no conversation history to be obtained, then we will want to initialize the database to prevent errors.
Since initializing the database when it already exists will do nothing, we are safe to call the endpoint even if a database already exists.
We can take advantage of this in our Requester, so that we can skip adding a separate method for initialization and, instead, handle it all when getting the history:
def prepare_conversation(self, user_one, user_two): endpoint = "/create_conversation_db" params = {"user_one": user_one, "user_two": user_two} ...