Up until this point we have only been able to get events the next upcoming events from our google calendar. In this tutorial I will show you how you can retrieve a list of events that occur in one day.
In the previous tutorials we used gTTS (Google Text-to-Speech) to output audio and speak to the user. Since I've noticed this module has a lot of problems I've decided to change to pyttsx3. This module is much easier to use and does not need an internet connection to produce voice.
We will start by installing it with pip:
Next we will import it into our python script.
And finally, replace our previous speak() function with the following:
Events By Day
Now we will modify our get_events() function to take in a date and print out the events that occur on that specific date. Unfortunatly the google calendar API is very picky when it comes to how it accepts date information. This means we need to do some work to convert our date object into the correct form.
Here is what our new get_events() function looks like:
Now if we call get_events() and pass a date we got from the get_date() function we will see a list of events on that specific day.
Now we can test out our new function by doing writing the following into the mainline of our program.
In the next tutorial we will make the assistant speak the events out to us.