google提醒的非官方api包装
google-reminder-api-wrapper的Python项目详细描述
用于google提醒的api包装器
这是一个正在进行的工作,创建一个api包装器,用于通过代码处理google提醒。因失踪官员 对于api的文档,这应该被认为是不稳定的,不能部署到任何生产系统中。
执行当前命令
- 获取
- 列表
- 创建
- 删除
未执行的命令
- 更新
安装
通过运行
python3 setup.py install
注意,这个包需要python 3。
用法
按照以下说明获取api会话凭据并将其添加到环境变量中。
SID='xxxxxxxxxxxxxxxxx'HSID='xxxxxxxxxxxxxxxxx'SSID='xxxxxxxxxxxxxxxxx'APISID='xxxxxxxxxxxxxxxxx'SAPISID='xxxxxxxxxxxxxxxxx'authorization='xxxxxxxxxxxxxxxxx'key='xxxxxxxxxxxxxxxxx' python
fromgoogle_reminder_api_wrapperimportReminderApiapi=ReminderApi()reminders=api.list()print(reminders)new_reminder=api.create('Test reminder','2019-01-10 15:00')reminders=api.list()print(reminders)api.delete(new_reminder)reminders=api.list()print(reminders)
底层google提醒api
授权
目前,google会话仍然基于http头中的固定cookies和授权密钥。
SID="xxxxxxxxxxxxxxxxx"HSID="xxxxxxxxxxxxxxxxx"SSID="xxxxxxxxxxxxxxxxx"APISID="xxxxxxxxxxxxxxxxx"SAPISID="xxxxxxxxxxxxxxxxx"authorization="xxxxxxxxxxxxxxxxx"key="xxxxxxxxxxxxxxxxx"
注意:凭据密钥需要设置为请求工作的环境变量。这是 一项正在进行的工作,并将在未来与谷歌会话api集成。
查找凭据
执行以下操作可以找到凭据
- 转到google日历,https://calendar.google.com并确保标记了“提醒”日历。
- 打开chrome开发工具的“网络”选项卡,搜索
reminders / list
- 在“页眉”子选项卡中,在“请求页眉”中找到所需的页眉
请求结构
以下是发送到提醒api的请求的主要结构
https://reminders-pa.clients6.google.com/v1internalOP/reminders/<COMMAND>
。
其中command是下列命令之一
- 获取
- 列表
- 更新
- 创建
- 删除
标题
'x-origin': 'https://calendar.google.com', 'content-type': 'application/json', 'authorization': '<SESSION AUTHORIZATION>,''key': '<SESSION KEY>,''cookie': '<SESSION COOKIES>'
google日历将这个api与数据负载中的application/json+protobuf
一起使用,但是由于可读性问题
这个包装器将模式的部分反向工程为普通的json字段名。
背景
由于以下google问题跟踪线程https://issuetracker.google.com/issues/36760283中的流行需求, 我决定试一试。包装器基于以下注释https://issuetracker.google.com/issues/36760283#comment193。
基于以下注释,https://issuetracker.google.com/issues/36760283#comment193,
There is an undocumented API, which is used for example by Google Calendar. Maybe someone with the skills and time can write a user friendly wrapper or service for it ;-)
https://reminders-pa.clients6.google.com/v1internalOP/reminders/list?key=XXX
Commands are: list, get, create, update, delete
Some more details for "list" in Japanese: https://qiita.com/futa/items/c7a04c7b0be35508a626