#NEWLINE# @ app . after_request #NEWLINE# def add_rate_limit_headers( response ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ( limit , remaining , expires ) = map ( int , g . rate_limits ) #NEWLINE# #UNINDENT# except ( AttributeError , ValueError ) : #NEWLINE# #INDENT# return expires #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# response . headers . add ( 'X-RateLimit-Remaining' , remaining ) #NEWLINE# response . headers . add ( 'X-RateLimit-Limit' , limit ) #NEWLINE# response . headers . add ( 'X-RateLimit-Reset' , expires ) #NEWLINE# return response