Link Twitter Facebook LinkedIn Github Email

Softserve.py

In some web projects that I've been working on, I've been trying to make sure that the end user's experience doesn't become awful when there is network lag. There are tricks you can anticipate like putting <script> tags at the end of the body, using an asynchronous JavaScript loader such as RequireJS or Head JS, precaching media, and so on, but it's still hard to get a qualitative sense for what the user will actually experience, especially on slow mobile Internet connections.

So I hacked together a small script to serve files with a randomized, simulated network lag. I run it on a local directory of files I want to serve, such as

softserve.py path_to_files

Then I can test my webapp by changing the links to point to http://localhost:8000/file.

If you've ever been in a similar predicament, you can check out the source at github.com or install it with pip install softserve.

Any feedback would be appreciated!