fairdm.contrib.autocomplete.throttling#

The limits on how often one caller may use the autocomplete addresses.

They count callers the way the API’s limits do, and each has a scope of its own, so a person typing into a search box does not use up an API allowance. Every rate is read from REST_FRAMEWORK["DEFAULT_THROTTLE_RATES"] under the scope named on its class. A portal that replaced that dictionary without these scopes is limited at the class’s default_rate.

Module Contents#

Classes#

DefaultRateMixin

Fall back to the class’s default_rate when the settings lack its scope.

AutocompleteAnonBurstThrottle

Limit a visitor over a short window.

AutocompleteAnonDailyThrottle

Limit a visitor over a day.

AutocompleteUserBurstThrottle

Limit a signed-in caller over a short window.

AutocompleteUserDailyThrottle

Limit a signed-in caller over a day.

API#

class DefaultRateMixin[source]#

Fall back to the class’s default_rate when the settings lack its scope.

Attributes: default_rate: The rate used when the settings do not give one for the scope.

default_rate = <Multiline-String>#
get_rate()[source]#

Return the configured rate, or the default when the scope is not configured.

Returns: The rate as "number/period".

class AutocompleteAnonBurstThrottle[source]#

Bases: fairdm.contrib.autocomplete.throttling.DefaultRateMixin, fairdm.api.throttling.AnonBurstThrottle

Limit a visitor over a short window.

Initialization

scope#

‘autocomplete_anon_burst’

default_rate#

‘60/minute’

class AutocompleteAnonDailyThrottle[source]#

Bases: fairdm.contrib.autocomplete.throttling.DefaultRateMixin, fairdm.api.throttling.AnonDailyThrottle

Limit a visitor over a day.

Initialization

scope#

‘autocomplete_anon_day’

default_rate#

‘5000/day’

class AutocompleteUserBurstThrottle[source]#

Bases: fairdm.contrib.autocomplete.throttling.DefaultRateMixin, fairdm.api.throttling.UserBurstThrottle

Limit a signed-in caller over a short window.

Initialization

scope#

‘autocomplete_user_burst’

default_rate#

‘240/minute’

class AutocompleteUserDailyThrottle[source]#

Bases: fairdm.contrib.autocomplete.throttling.DefaultRateMixin, fairdm.api.throttling.UserDailyThrottle

Limit a signed-in caller over a day.

Initialization

scope#

‘autocomplete_user_day’

default_rate#

‘50000/day’