#NEWLINE# @ action ( route = '/radiovis/api/<secret>/cleanup_logs' ) #NEWLINE# @ only_orga_admin_user ( ) #NEWLINE# @ json_only ( ) #NEWLINE# def radiovis_api_cleanup_logs( request , secret ) : #NEWLINE# #INDENT# 'Cleanup logs if timestamp < time.time() - max_age' #NEWLINE# if ( secret != config . API_SECRET ) : #NEWLINE# #INDENT# abort ( 404 ) #NEWLINE# return #NEWLINE# #UNINDENT# from sqlalchemy.sql import text #NEWLINE# db . engine . execute ( text ( 'DELETE FROM log_entry WHERE reception_timestamp <  :t' ) , t = ( time . time ( ) - int ( request . form . get ( 'max_age' ) ) ) ) #NEWLINE# return { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# }