nozbe接口包装器。
mekk.nozbe的Python项目详细描述
mekk.nozbewrapps(python的显著部分)Nozbeapi 功能。
它同时使用了旧的、正式发布的api (http://www.nozbe.com/gtd/api)和新的(尚未正式发布) “同步API”。这两个api都没有完全覆盖(模块 支持2009年初的工作,以及 但我仍然成功地使用了库来提取项目, 来自Nozbe的上下文和任务并创建新的(或更新现有的) 项目。
代码当前使用的是Twisted网络接口(这意味着 归还延期等)。嗯,我喜欢扭曲。我考虑提供 基于urllib的同步api作为替代,只需要一些 动力。
诺兹贝托醇
除了库之外,nozbetool脚本还捆绑在一起。运行:
nozbetool --help
详细情况。最常用的用法:
nozbetool export --csv=file.csv --user=YourNozbeUsername
(导出到.csv)或:
nozbetool export --json=file.json --user=YourNozbeUsername --completed
(导出到.json,包含已完成的操作)。
注意:仅.json导出包含注释!
示例
一些简单的例子:
from mekk.nozbe import NozbeApi, NozbeConnection from twisted.internet import reactor, defer # API KEY servers as an authentication token. # Check for your own at Nozbe extras page (http://www.nozbe.com/account/extras). # Note that publishing it is equivalent to publishing the password. API_KEY = "grab your own from Nozbe" @defer.inlineCallbacks def make_some_calls(): connection = NozbeConnection(API_KEY) nozbe_client = NozbeApi() print "* Some projects" projects = yield nozbe_client.get_projects() for project in projects[:3]: print project print print "* Some contexts" contexts = yield nozbe_client.get_contexts() for context in contexts[:3]: print context print print "* Some tasks" tasks = yield nozbe_client.get_tasks() for task in tasks[:3]: print task print print "Adding example task" yield nozbe_client.add_task( u"Example task made using script", project_hash = projects[0]['hash'], context_hash = contexts[0]['hash'], next = 1) @defer.inlineCallbacks def main(): try: yield make_some_calls() finally: reactor.stop() reactor.callLater(0, main) reactor.run()