跳转到主要内容

命令行工具和用于与toggl的API交互的Python包装类集合

项目描述

Toggl CLI

PyPI version PyPI - Python Version PyPI - Downloads codecov Build Status

命令行工具和用于与toggl的API交互的Python包装类集合

安装

安装此软件包的最简单方法是使用PyPi

$ pip install togglCli

用法

要全面了解Toggl CLI的功能,请参阅完整文档

命令行工具

在首次运行命令时,您将被问及几个问题以启动默认配置文件(仅支持UNIX-like系统;对于Windows用户,已创建示例配置文件,您需要手动设置)。

要查看所有命令和选项的概述,请使用--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类似。

这些包装器依赖于配置对象,如果没有提供,则使用默认配置文件(例如~/.togglrc)。

Toggl CLI 使用 pendulum 进行日期时间管理,但与 Python 的原生日期时间兼容,所以如果您想使用的话也可以。

from toggl import api, utils
import pendulum

new_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 file
config = 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 file
config.api_token = 'your token'
config.timezone = 'utc'  # Custom timezone

project = api.Project.object.get(123, config=config)
project.name = 'Some new name'
project.save()

贡献

请随时参与,欢迎贡献!打开问题或提交 PR。

有关 PR,请参阅贡献指南

许可证

MIT © Adam Uhlir & D. Robert Adams

项目详情


下载文件

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

源代码发行版

togglCli-3.0.2.tar.gz (114.1 kB 查看哈希值)

上传 源代码

构建发行版

togglCli-3.0.2-py2.py3-none-any.whl (87.1 kB 查看哈希值)

上传 Python 2 Python 3

由以下机构支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面