class evennia.server.throttle.Throttle(**kwargs)[source]

Bases: object

Keeps a running count of failed actions per IP address.

Available methods indicate whether or not the number of failures exceeds a particular threshold.

This version of the throttle is usable by both the terminal server as well as the web server, imposes limits on memory consumption by using deques with length limits instead of open-ended lists, and removes sparse keys when no recent failures have been recorded.

error_msg = 'Too many failed attempts; you must wait a few minutes before trying again.'

Allows setting of throttle parameters.

Keyword Arguments
  • limit (int) – Max number of failures before imposing limiter

  • timeout (int) – number of timeout seconds after max number of tries has been reached.

  • cache_size (int) – Max number of attempts to record per IP within a rolling window; this is NOT the same as the limit after which the throttle is imposed!


Convenience function that returns the storage table, or part of.


ip (str, optional) – IP address of requestor


storage (dict)

When no IP is provided, returns a dict of all

current IPs being tracked and the timestamps of their recent failures.

timestamps (deque): When an IP is provided, returns a deque of

timestamps of recent failures only for that IP.

update(ip, failmsg='Exceeded threshold.')[source]

Store the time of the latest failure.

  • ip (str) – IP address of requestor

  • failmsg (str, optional) – Message to display in logs upon activation of throttle.




This will check the session’s address against the storage dictionary to check they haven’t spammed too many fails recently.


ip (str) – IP address of requestor


throttled (bool)

True if throttling is active,

False otherwise.