#NEWLINE# def get( self , request , slug , year , month ) : #NEWLINE# #INDENT# addon = self . get_addon ( request , slug ) #NEWLINE# check_stats_permission ( request , addon ) #NEWLINE# data = [ ] #NEWLINE# path = '{id}/{year}/{month}/' . format ( id = addon . id , year = year , month = month ) #NEWLINE# try : #NEWLINE# #INDENT# files = storage . listdir ( path ) #NEWLINE# #UNINDENT# except OSError : #NEWLINE# #INDENT# return Response ( { #NEWLINE# #INDENT# 'error' : ( 'No archived data for addon "%s" found.' % addon . slug ) , #NEWLINE# #UNINDENT# } , status = status . HTTP_404_NOT_FOUND ) #NEWLINE# #UNINDENT# for file_ in files [ 1 ] : #NEWLINE# #INDENT# ( file_name , _ ) = os . path . splitext ( file_ ) #NEWLINE# ( date_str , model_name ) = file_name . rsplit ( '_' , 1 ) #NEWLINE# day = datetime . strptime ( date_str , '%Y_%m_%d' ) . date ( ) #NEWLINE# data . append ( { #NEWLINE# #INDENT# 'addon_id' : addon . id , #NEWLINE# 'date' : day , #NEWLINE# 'model_name' : model_name , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# return Response ( data )