Skip to main content

You can use `TaskTimer` to automatically calculate when a given task will be executed based on a specified duration in seconds.

Project description

TaskTimer

TaskTimer is a Python class used to schedule and keep track of upcoming actions. You can use TaskTimer to automatically calculate when a given action will be executed based on a specified duration in seconds.

Usage

To use the TaskTimer class, you need to initialize an instance of the class with an action and the amount of seconds until the action will be executed.

from task_timer import TaskTimer

Initialize a new TaskTimer

task_timer = TaskTimer('send_email', 3600)

Print the next action time in a human-friendly format

print(task_timer.human_friendly())

Print the next action time as a datetime object

print(str(task_timer))

Print all upcoming actions

print(TaskTimer.get_upcoming_actions())

In the example above, 'send_email' is the action we're scheduling, and 3600 is the number of seconds until the action will be executed.

Installation

This package can be installed using pip:

pip install task-timer

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

task_timer_birdhouses-0.0.4.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

task_timer_birdhouses-0.0.4-py3-none-any.whl (3.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page