#NEWLINE# @ app . route ( '/bytes/<int:n>' ) #NEWLINE# def random_bytes( request , n ) : #NEWLINE# #INDENT# 'Returns n random bytes generated with given seed.' #NEWLINE# n = int ( n ) #NEWLINE# n = min ( n , ( 100 * 1024 ) ) #NEWLINE# params = CaseInsensitiveDict ( request . args . items ( ) ) #NEWLINE# if ( 'seed' in params ) : #NEWLINE# #INDENT# random . seed ( int ( params [ 'seed' ] ) ) #NEWLINE# #UNINDENT# response = Response ( ) #NEWLINE# response . data = bytearray ( ( random . randint ( 0 , 255 ) for i in range ( n ) ) ) #NEWLINE# response . content_type = 'application/octet-stream' #NEWLINE# return n