Skip to content

ticktok-io/ticktok-python

Repository files navigation

Ticktok.io Python client

Build

This is the official Python client for Ticktok.io

Installation

pip install ticktok

Usage

Scheduling of a simple clock

ticktok = Ticktok(url, token)
ticktok.register(name='email:birthdays', schedule='every.30.seconds', send_bd_emails())

Scheduling using decorators

ticktok = Ticktok(url, token)

@ticktok.listen_on(name='email:birthdays', schedule='every.30.seconds')
def send_emails_for_upcoming_birthdays():
    pass

Unregistering of callbacks

ticktok.unregister_all() # all callbacks
ticktok.unregister(name='email:birthdays', schedule='every.30.seconds') # all callbacks for clock
ticktok.unregister(name='email:birthdays', schedule='every.30.seconds', callback=send_bd_emails()) # specific callback

Invoke an action on an existing clock. These are global operation and might affect other clients as well

clock = ticktok.clock(name='event:start', schedule='every.5.minutes')
clock.tick()
clock.pause()
clock.resume()