Google Calendar Wrapper API creates a schedule with natural language in Japanese. This script provides RESTful API interface and enables integrations for some tools.
One usecase is to use this with iOS shortcuts.
The configuration of iOS shortcut is here.
- Get access token from Google Cloud console
https://console.cloud.google.com/apis/api/calendar-json.googleapis.com/overview
- Install packages
python -m venv env
. env/bin/activate
pip install -r requirements.txt
- Set Google Calendar ID as an environment variable
export GOOGLE_CALENDAR_ID="xxx"
- Dry-run google_calendar.py
This script creates a schedule on the Google Calendar.
python google_calendar.py
- Start HTTP server
python main.py
- Send an HTTP request to the server
curl -XPOST -u koyama:pA55word -H 'Content-Type: application/json' \
-d '{"title": "test1", "body": "2024-12-24の12:00から14:00"}' 'http://localhost:8080/v1/schedule'
- Create venv
python -m venv env
. env/bin/activate
- Install packages
pip install -r requirements.txt
- Dry-run google_calendar.py
python google_calendar.py
- Start the app server
AUTH_USER=xxx AUTH_PASSWORD=xxx gunicorn main:app --bind 0.0.0.0:8080
- Add the
gcalapi
user
sudo useradd -s /bin/bash gcalapi
- Write
.env-vars
on the project root
cat <<EOF > .env-vars
AUTH_USER=xxx
AUTH_PASSWORD=xxx
[email protected]
EOF
- Edit
gcalapi.service
WorkingDirectory=/path/to
ExecStart=/path/to/env/bin/gunicorn main:app --bind 127.0.0.1:8080
EnvironmentFile=/path/to/.env-vars
- Copy the
gcalapi.service
file
sudo install gcalapi.service /etc/systemd/system/
- Apply the service
sudo systemctl daemon-reload
sudo systemctl start gcalapi
sudo systemctl enable gcalapi
- Check logs
sudo systemctl status gcalapi
- Start NGINX as a proxy
sudo apt install nginx
sudo ./nginx.conf /etc/nginx/conf.d/
sudo nginx -t
sudo systemctl start nginx
sudo systemctl enable nginx