Give your application a break.
Sleep soundly. Sleep randomly.
The narcolepsy package contains code which alters the behavior of your application/api by injecting random sleep calls into its code paths.
The following code is an example of using the @narcoleptic decorator.
from narcolepsy import narcoleptic @narcoleptic(max=5) # sleep for 5 seconds at max def foobar(): for x in xrange(1024): nested_function(x)
The easiest way to install narcolepsy is via pip:
$ pip install narcolepsy
Why not? There are probably testing applications that I haven’t considered where timing is an integral component to the execution environment. Or you could use this to make sneaking by CAPTCHAs a bit easier :D
See the LICENSE file for details.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.