Skip to main content

A loop timer instead of default one shot Timer from threading. Base on pythonTimer created by terryltang.

Project description

Python looping timer. Forked from terryltang/pythonTimer

Install

pip install loopytimer

Feature & Usage

  • Require Python standard library: threading

  • Call a function after a specified number of seconds:

e.g.:
from loopytimer import LoopyTimer

timer = LoopyTimer(5.0, handler_func, args=[], kwargs={})
timer.set_call_limits(5)    # timer will run eternally if you don't set a limit
timer.start()
timer.cancel()     # cancel the timer's action if it's still waiting, will also destroy timer instance
  • Timer handler take positional arguments and keyword arguments:

e.g.:
timer = LoopyTimer(0.5, timer_handler, args=["Terry", "Tang"], kwargs={"city":"Houston", "state":"Texas"})
  • Cancel and destroy timer.

  • Add a customized logger function for timer handler.

  • Test cases included.

License

MIT License

Copyright (c) 2018 Wavky Huang

See -> LICENSE

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

loopytimer-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

loopytimer-0.1.0-py2.py3-none-any.whl (5.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file loopytimer-0.1.0.tar.gz.

File metadata

  • Download URL: loopytimer-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for loopytimer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7b6a183d0238451da9e6fdb1964f5a9ab5a266facdcac75475ce54515472ba12
MD5 2d049dfe40efd583dada13b103c37542
BLAKE2b-256 b0ca6378212484b14caf3c7a356a3ad1231c9aaf9812195483cd755fb62ef7c5

See more details on using hashes here.

File details

Details for the file loopytimer-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for loopytimer-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6444daf5da6be0f1720e0ca05e7c0cf956fa6bd00084df8f87dd592743fe04bc
MD5 2b5f8d1c9c65bc953b45645bdfa4fb4f
BLAKE2b-256 9fec50a9b89f4804b962ef86406982405d82e56826970ca3e6eec2d4a2865fab

See more details on using hashes here.

Supported by

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