Tweens is a middleware subsystem for Pyramid framework. It allows you to run code before and after processing HTTP request.
Please see ws-tweens command.
ws-tweens