@decorator
def x_runtime(f, *args, **kwargs):
 _t0 = now()
 r = f(*args, **kwargs)
 _t1 = now()
 r.headers['X-Runtime'] = '{0}s'.format(Decimal(str((_t1 - _t0))))
 return r

@ decorator def x_runtime ( f , * args , ** kwargs ) : _t0 = now ( ) r = f ( * args , ** kwargs ) _t1 = now ( ) r . headers [ 'X-Runtime' ] = '{0}s' . format ( Decimal ( str ( ( _t1 - _t0 ) ) ) ) return r
x-runtime flask response decorator .