用于与toggl的api交互的命令行工具和一组python包装类
togglCli的Python项目详细描述
toggl cli
Command line tool and set of Python wrapper classes for interacting with toggl's API
安装
安装此软件包的最简单方法是通过pypi:
$ pip install togglCli
用法
有关toggl cli功能的完整概述,请参见full documentation。
cli工具
在第一次运行该命令时,您将被问到几个问题来引导默认配置文件 (仅支持类unix系统;对于window s用户,创建了虚拟配置文件,您必须手动设置该文件)。
要获得所有命令和选项的概述,请使用--help
选项。还可以查看子命令的帮助页!
命令的几个示例:
# Starts tracking new time entry $ toggl start # Displays/enable modifications of currently running time entry $ toggl now # Lists all projects $ toggl projects ls
API包装
toggl cli附带了一组python类包装器,它们遵循类似于django orm的模式。
包装器取决于配置对象,如果没有提供,则使用默认配置文件(eq.~/.togglrc
)。
toggl cli使用pendulum
进行日期时间管理,但它与python的本机日期时间兼容,因此如果愿意,可以使用它。
fromtogglimportapi,utilsimportpendulumnew_entry=api.TimeEntry(description='Some new time entry',start=pendulum.now()-pendulum.duration(minutes=15),stop=pendulum.now())new_entry.save()list_of_all_entries=api.TimeEntry.objects.all()current_time_entry=api.TimeEntry.objects.current()# Custom config from existing fileconfig=utils.Config.factory('./some.config')# Custom config without relying on any existing config file config=utils.Config.factory(None)# Without None it will load the default config fileconfig.api_token='your token'config.timezone='utc'# Custom timezoneproject=api.Project.object.get(123,config=config)project.name='Some new name'project.save()
贡献
欢迎大家踊跃参与,踊跃投稿!Open an issue或提交prs。
有关prs,请参见contribution guideline。
许可证
MIT © Adam Uhlir & D. Robert Adams