跳转到主要内容

Nozbe接口封装。

项目描述

mekk.nozbe 将 (注意部分) Nozbe API 封装为Python函数。

它使用旧版已发布的API (http://www.nozbe.com/gtd/api) 和新的(尚未官方文档化的)“同步API”。这两个API都没有完全覆盖(模块支持2009年初有效的功能,这是我需要的),但我仍然成功地使用这个库从Nozbe提取项目和任务,并创建新的(或更新现有的)条目。

当前代码正在使用Twisted网络接口(这意味着返回deferred等)。嗯,我喜欢Twisted。我考虑提供基于urllib的同步API作为替代方案,只需要一些动力。

nozbetool

除了库之外,还包含nozbetool脚本。运行

nozbetool --help

获取详细信息。最常见用法

nozbetool export --csv=file.csv --user=YourNozbeUsername

(导出到.csv)或

nozbetool export --json=file.json --user=YourNozbeUsername --completed

(导出到.json,包括已完成的操作)。

注意:只有.json导出包含备注!

开发

开发跟踪在 http://bitbucket.org/Mekk/mekk.nozbe/

示例

一些简单的示例

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()

项目详情


下载文件

下载您平台的文件。如果您不确定选择哪一个,请了解更多关于 安装包 的信息。

源分布

mekk.nozbe-0.4.2.tar.gz (11.7 kB 查看哈希值)

上传时间