wunderlist2restapi的python库
wunderpy2-python-3-fixes的Python项目详细描述
概述
wunderpy2是一个用于访问the official Wunderlist 2 API的瘦python库。薄库在这里是什么意思?
- 只执行通过the Wunderlist API specifications的最小错误检查(例如,即使WunderList Web客户端强制使用非空标题,也不检查任务标题是否为空)。
- 没有任何“便利”功能,比如按名称而不是id获取列表(也就是说,我可能厌倦了自己重复同样的事情,编写一些,并将它们打包到一个单独的helper模块中)。
安装
pip install wunderpy2
用法和示例
获得客户
WunderList使用OAuth2允许应用程序访问用户的数据,因此在执行任何操作之前需要create an application。如果您只想访问自己的WunderList,请在创建应用程序后生成一个访问令牌,并按如下方式使用它和客户端ID:
import wunderpy2 api = wunderpy2.WunderApi() client = api.get_client(access_token, client_id) # Fill in your values
如果您希望其他WunderLister使用您的应用程序,则需要查看the authorization docs中的“重定向用户以请求WunderList访问”部分,以便在用户授权您的应用程序时获取临时代码。获得代码后,只需再执行一步即可:
api = wunderpy2.WunderApi() access_token = api.get_access_token(temporary_code, client_id, client_secret) # Fill in your values here client = api.get_client(access_token, client_id) # Fill in your client ID
WunderList对象
所有wunderlist对象都只是具有特殊键的python对象。为了方便起见,这些键以类格式排列在model.py
中。请注意,并非每个对象都有每个键(例如,具有“inbox”类型的列表对象没有创建元数据)。
示例
创建带有截止日期、备注、“星号”标志和子任务的任务:
lists = client.get_lists() list = lists[0] task = client.create_task(1234, "My new task", due_date="2015-08-02", starred=True) client.create_note(task[wunderpy2.Task.ID], "My note") client.create_subtask(task[wunderpy2.Task.ID], "My subtask")
在列表中无序排列任务顺序(请参见the Positions endpoint documentation):
import random task_positions_obj = client.get_task_positions_obj(list[wunderpy2.List.ID]) ordering = task_positions_obj[wunderpy2.Task.VALUES] random.shuffle(ordering) client.update_task_positions_obj(task_positions_obj[wunderpy2.TaskPositionsObj.ID], task_positions_obj[wunderpy2.TaskPositionsObj.REVISION], ordering)
待办事项
- 端点实现:
- 化身
- 文件
- 文件预览
- 文件夹
- 提醒
- 任务注释
- 上传
- 用户
- 网络挂钩?
发布历史记录
tba
- 从dict.iteritems()切换到dict.items()以实现python 2&3的兼容性
- 在面向公众的api中公开更多的类
0.1.4(2016/03/14)
- 任务终结点代码中的错误修复
0.1.3(2016/03/12)
- 修复python 3的导入
0.1.2(2015/10/31)
- 添加了“位置”端点
- 添加了“子任务”终结点
0.1.1(2015/08/16)
- fixed setup.py需要python的“argparse”模块>;2.6
贡献者
还没人!