A Python library for analyzing Google Calendar data.
Project description
Google Calendar Analytics
This Python program allows you to perform analytics on your Google Calendar events. With this program, you can visualize the total duration of your events, compare the length of events across different time periods, and gain insights into which events take up the most time.
Features
- Async support for faster data retrieval and chart generation
- Extract events from your Google Calendar
- Compute the total duration of events in a specified time range
- Visualize the duration of events in a pie chart, bar chart, line chart and more
- Limit the number of events displayed in the charts
- Wide chart customization. For example, dark mode and transparent background
Quick Start
To use the Google Calendar Analytics program, first install the dependencies by running the following command:
pip install google-calendar-analytics
You can then import the AnalyzerFacade class and use it to analyze your data:
How to get credentials from Google?
import asyncio
from datetime import datetime
from google.oauth2.credentials import Credentials
from google_calendar_analytics import AnalyzerFacade
from google_calendar_analytics.visualization.visual_design import base_plot_design
# (You can get it from Google OAuth2 in you web app or from link above)
# Example of creds dictionary. (You can get it from Google OAuth2 in your web app)
creds = {
"token": "ya29.a0AVvZVsoH4qZcrGK25VwsXspJv-r9K-",
"refresh_token": "1//0hwlhrtalKgeRCgYIARAAGBESNwF-",
"token_uri": "https://oauth2.googleapis.com/token",
"client_id": "395np.apps.googleusercontent.com",
"client_secret": "GOCSPXFqoucE03VRVz",
"scopes": ["https://www.googleapis.com/auth/calendar"],
"expiry": "2023-02-18T15:30:15.674219Z"
}
creds = Credentials.from_authorized_user_info(creds)
Once you have created the credentials, you can create an instance of the AnalyzerFacade class and use it to analyze your data:
analyzer = AnalyzerFacade(creds=creds, visual_design=base_plot_design)
# Choose time range for analysis
start_time = datetime(2023, 3, 1)
end_time = datetime(2023, 3, 18)
def main():
plot = await analyzer.analyze_one(start_time, end_time, event_name="Programming", plot_type="Line")
plot.show()
if __name__ == "__main__":
asyncio.run(main())
Contribution
If you would like to contribute to this project, please feel free to submit a pull request. Some areas where contributions are particularly welcome include:
- Adding new features
- Improving existing features
- Debugging and fixing bugs
- Adding tests to ensure the program is working as expected
Analytics example:
Pie plot | Bar plot |
---|---|
Line plot | Multy line plot |
---|---|
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for google_calendar_analytics-0.4.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f719ecdcbd964a5db963229b1611bf69752bfc2d7c4cbd2602022c5f1ab1fa46 |
|
MD5 | 0792ee801f09d7ca9ae9ca8c77f26012 |
|
BLAKE2b-256 | 0412f0e06e2db8defb73eb6c8ec5205d0b31f5e9b2ddad3568dc6b6fd8ac9f59 |
Hashes for google_calendar_analytics-0.4.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d18bd9cda30bab788ef7a2cf27fc8098c68cd83b257a1c7eef72dfdfd5f89130 |
|
MD5 | ec66f03ed46e99e91f0728bdb086e23d |
|
BLAKE2b-256 | 9534cda73aa38a6f289ca3421b1b2dd80127c95af0734b694d71d261c81d4203 |