pyrate_limiter.clocks module#

Clock implementation using different backend

class pyrate_limiter.clocks.MonotonicClock#

Bases: pyrate_limiter.abstracts.clock.AbstractClock

now()#

Get time as of now, in miliseconds

class pyrate_limiter.clocks.PostgresClock(pool)#

Bases: pyrate_limiter.abstracts.clock.AbstractClock

Get timestamp using Postgres as remote clock backend

now()#

Get time as of now, in miliseconds

Return type

int

class pyrate_limiter.clocks.SQLiteClock(conn)#

Bases: pyrate_limiter.abstracts.clock.AbstractClock

Get timestamp using SQLite as remote clock backend

conn#
classmethod default()#
now()#

Get time as of now, in miliseconds

Return type

int

time_query = "SELECT CAST(ROUND((julianday('now') - 2440587.5)*86400000) As INTEGER)"#
class pyrate_limiter.clocks.TimeAsyncClock#

Bases: pyrate_limiter.abstracts.clock.AbstractClock

Time Async Clock, meant for testing only

async now()#

Get time as of now, in miliseconds

Return type

int

class pyrate_limiter.clocks.TimeClock#

Bases: pyrate_limiter.abstracts.clock.AbstractClock

now()#

Get time as of now, in miliseconds