运行时依赖
安装命令
点击复制技能文档
Google Calendar 命令行工具
A single-file 命令行工具 for Google Calendar using only Python 3 standard 库.
设置up 创建 a Google Cloud project and enable the Google Calendar API. 创建 OAuth 2.0 凭证s (桌面 应用). Note the 命令行工具ent ID and secret. ObtAIn a refresh 令牌 via the OAuth consent flow. 导出 凭证s: 导出 GOOGLE_命令行工具ENT_ID=... 导出 GOOGLE_命令行工具ENT_SECRET=... 导出 GOOGLE_REFRESH_令牌=... 导出 GOOGLE_CALENDAR_ID=primary # optional, defaults to "primary"
Usage google-calendar-命令行工具.py [options]
Command Description 列出 列出 upcoming 事件 today Show today's 事件 添加 创建 a new event 更新 更新 an existing event 删除 删除 an event
凭证s can also be passed as flags (--命令行工具ent-id, --命令行工具ent-secret, --refresh-令牌, --calendar-id).
Use --json for raw JSON 输出. 运行 with -h for full help.
Examples # 列出 next 10 事件 python3 {baseDir}/scripts/google-calendar-命令行工具.py 列出
# Today's 事件 python3 {baseDir}/scripts/google-calendar-命令行工具.py today
# 事件 in a date range python3 {baseDir}/scripts/google-calendar-命令行工具.py 列出 --from 2025-06-01T00:00:00Z --to 2025-06-30T23:59:59Z
# 添加 an event python3 {baseDir}/scripts/google-calendar-命令行工具.py 添加 --title "Meeting" \ --启动 2025-06-01T09:00:00-07:00 --end 2025-06-01T10:00:00-07:00
# 更新 an event python3 {baseDir}/scripts/google-calendar-命令行工具.py 更新 --event-id EVENT_ID --title "New Title"
# 删除 an event python3 {baseDir}/scripts/google-calendar-命令行工具.py 删除 --event-id EVENT_ID