360 Secure SkillHub
360 安全技能中心

py-googlecalendar-cli

这是仅依赖Python3标准库的Google Calendar命令行工具,核心功能含查看近期/今日事件、增删改查日历事件,支持日期范围筛选。适合终端快速管理日历,无需打开网页或APP。需先配置Google Calendar API及OAuth2凭证(可通过环境变量或命令行flag传入)。输入为指定命令加选项的形式,输出默认是易读文本,加`--json`可获取原始JSON结果,兼容Python3.6+。

xwings
xwings
热度 48.88
最近更新 2026-05-11 17:32:23
分类:自动化依赖:代码执行 / 第三方 API / 读写文件应用场景:任务管理 / 日程安排 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add py-googlecalendar-cli
Metadata
name
google-calendar
description
Tiny and short Python CLI tool to manage Google Calendar events from the command line -- list, add, update, delete events via the Calendar API.
license
MIT
homepage
https://github.com/xwings/py-googlecalendar-cli
compatibility
Requires Python 3.6+. Network access to Google Calender
metadata
{"author":"xwings","openclaw":{"env":["GOOGLE_CLIENT_ID","GOOGLE_CLIENT_SECRET","GOOGLE_REFRESH_TOKEN","GOOGLE_CALENDAR_ID"],"bins":["python3 {baseDir}/scripts/google-calendar-cli.py"]}}

Google Calendar CLI

A single-file CLI for Google Calendar using only Python 3 standard library.

Setup

  1. Create a Google Cloud project and enable the Google Calendar API.
  2. Create OAuth 2.0 credentials (Desktop app). Note the client ID and secret.
  3. Obtain a refresh token via the OAuth consent flow.
  4. Export credentials:
    export GOOGLE_CLIENT_ID=...
    export GOOGLE_CLIENT_SECRET=...
    export GOOGLE_REFRESH_TOKEN=...
    export GOOGLE_CALENDAR_ID=primary  # optional, defaults to "primary"
    

Usage

google-calendar-cli.py <command> [options]
Command Description
list List upcoming events
today Show today's events
add Create a new event
update Update an existing event
delete Delete an event

Credentials can also be passed as flags (--client-id, --client-secret, --refresh-token, --calendar-id).

Use --json for raw JSON output. Run with -h for full help.

Examples

# List next 10 events
python3 {baseDir}/scripts/google-calendar-cli.py list

# Today's events
python3 {baseDir}/scripts/google-calendar-cli.py today

# Events in a date range
python3 {baseDir}/scripts/google-calendar-cli.py list --from 2025-06-01T00:00:00Z --to 2025-06-30T23:59:59Z

# Add an event
python3 {baseDir}/scripts/google-calendar-cli.py add --title "Meeting" \
    --start 2025-06-01T09:00:00-07:00 --end 2025-06-01T10:00:00-07:00

# Update an event
python3 {baseDir}/scripts/google-calendar-cli.py update --event-id EVENT_ID --title "New Title"

# Delete an event
python3 {baseDir}/scripts/google-calendar-cli.py delete --event-id EVENT_ID