Google Calendar integration - ParthBibekar/Welearn-bot GitHub Wiki
Integration with Google Calendar is completely optional. This feature allows you to save your assignment dates directly to Google Calendar, via --gcalendar
option.
Authentication and configuration
For the very first time, you will have to authenticate using OAuth2.0 - follow the given steps.
- Go to the Google Cloud Console, while logged in to your desired account. If you are new to the platform, you will be prompted to agree and continue.
- Click on Create Project. Enter a suitable name, and leave the organization blank.
- In the search bar, search for "Google Calendar API", and enable it.
- Click on Credentials > Configure Consent Screen.
- Choose External. Enter the "App Name", "User support email" and "Developer Contact Information" with your desired values. Click Save and Continue.
- Fill in the "Test User's Email ID" with the address which you will be using to add events. Click Save and Continue > Back to Dashboard.
- In "API's & Services", click on Credentials > Create Credentials > OAuth client ID. Set the Application type to "Desktop app", add a suitable client name, and click Create. Upon being prompted, click OK.
- In the "OAuth 2.0 Client ID's", click on the client name you just created. You'll see a page with "Client ID" and "Client secret" values
given on the right. Copy these and add the following lines to your config file (
.welearnrc
orwelearn.ini
), filling in your values.
[gcal]
client_id = xxxxxxxxxxxxxxx.apps.googleusercontent.com
client_secret = xxxxxxxxxxxxxxxxx
When you run the program using the --gcalendar
option for the first time, you will be taken to an OAuth2.0 login page in your browser.
You will stay logged in for at most a day.
If you want your events to be saved to a calendar other than your primary one, go to Google Calendar and create a new calendar.
Once it appears under "My Calendars", open its settings, scroll down to "Integrate calendar" and copy the "Calendar ID".
Update your config with this line under the [gcal]
section.
calendar_id = [email protected]
Usage
The following commands are equivalent. They show all your due assignments, fetch the attached files, and add/update the corresponding events in your chosen calendar.
welearn_bot --dueassignments --gcalendar assignments ALL
welearn_bot -dc a ALL
Note that the event created in your calendar will extend from one hour before the due date and time, up to the exact due time.
See the relevant sections in