See public events from IEEE Colombia in: IEEE Colombia Events
This project synchronizes events from the IEEE vTools API to a Google Calendar. It fetches events for a specific country (Colombia by default) and adds or updates them in a Google Calendar.
- Fetches events from the IEEE vTools API.
- Filters events by country.
- Synchronizes events with a Google Calendar:
- Adds new events.
- Updates existing events if they have changed.
- Skips events that are already up-to-date.
- Python 3.7 or higher
- Google Calendar API credentials
- Internet connection
-
Clone the repository:
git clone <repository-url> cd <repository-folder>
-
Build the Docker image:
docker build -t event-calendar-synchronizer .
-
Run the Docker container:
docker run -it --rm event-calendar-synchronizer --calendar-id <calendar_id> --country-id <country_id>
You can also use an .env
file to set up the environment variables for the Docker container.
-
Set up Configuration:
- Copy
.env.example
to.env
- Update
.env
file with your data
- Copy
-
Run the Docker container:
docker build -t event-calendar-synchronizer . docker run -it --env-file=.env --rm event-calendar-synchronizer
-
Clone the repository:
git clone <repository-url> cd <repository-folder>
-
Install dependencies: Install the required Python packages using pip:
pip -m venv .venv source ./.venv/bin/activate pip install -r requirements.txt
-
Set up Configuration:
- Copy
.env.example
to.env
- Update
.env
file with your data
- Copy
-
Set up Google Calendar API credentials:
- See Python quickstart to set up the Google Calendar API credentials.
- Move the client secret JSON file to the project folder and rename it to
credentials.json
.
-
Run the script: You can run the script using Python and adding extra arguments (you can use
--help
to see all the options):python main.py --calendar-id <calendar_id> --country-id <country_id>
The first time you run the script, it will prompt you to authenticate with your Google account. This will generate a
token.json
file for future use.bash python main.py
See
- Fetching Events:
- The script uses the IEEE vTools API to fetch a list of events.
- Events are filtered by the country ID (Colombia's ID is 45).
- Event Synchronization:
- The script initializes the CalendarAPI class, which handles communication with the Google Calendar API.
- For each event fetched from the vTools API:
- If the event does not exist in the calendar, it is added.
- If the event exists but has been updated, it is modified in the calendar.
- If the event is already up-to-date, no changes are made.
- Statistics:
- At the end of the synchronization process, the script prints a summary of the number of events added, updated, and unchanged.
Country ID: The country ID can be changed in the main.py
file. The default country is Colombia (ID: 45).
To look for country you can use the following command:
$ curl "https://events.vtools.ieee.org/RST/events/api/public/v5/countries/list" | jq '.data[] | select(.attributes.name == "Colombia") | .attributes | del(.states) | .'
{
"id": 45,
"name": "Colombia",
"abbreviation": "CO"
}
Google Calendar ID: The Google Calendar ID can be changed in the calendar_api.py
file. The default calendar is the primary calendar of the authenticated user.
Replace this with the ID of the calendar you want to use. You can find the ID in the Google Calendar settings.
credentials.json # Google API credentials
token.json # Generated after authentication
lib/
__init__.py # Empty file for module initialization
calendar_api.py # Handles Google Calendar API interactions
vtools_fetcher.py # Fetches and processes events from the IEEE vTools API
main.py # Entry point for the script
README.md # Project documentation