djangosnippets.org: Latest snippets tagged with 'rate'https://djangosnippets.org/tags/rate/2008-09-24T04:07:29.008999-05:00Decorator to limit request rates to individual views
2008-09-24T04:07:29.008999-05:00jensbreithttps://djangosnippets.org/snippets/1083/<p>Example:</p>
<pre><code>@limit("global", 3, 10, per_ip=True)
def view(request, ...):
</code></pre>
<p>The example limits the view to one request every 3 seconds per ip address. The limit is shared by every view that uses the string "global" (first parameter), which is an arbitrary string. Request succeed until the accumulated requested time in seconds …</p>
Freely redistributable