#NEWLINE# def make_request_callback( self , timeout_count , body_on_success , http_error_status = 504 ) : #NEWLINE# #INDENT# '\n        Make a request callback that timeout a couple of time before returning body_on_success\n\n        Returns:\n            A tuple (request_callback, attempts), attempts is an array of size one that contains the number of time\n            request_callback has been called.\n        ' #NEWLINE# attempts = [ 0 ] #NEWLINE# def request_callback( request ) : #NEWLINE# #INDENT# attempts [ 0 ] += 1 #NEWLINE# if ( attempts [ 0 ] <= timeout_count ) : #NEWLINE# #INDENT# return ( http_error_status , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , 'Timeout' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# resp_body = dict ( body_on_success ) #NEWLINE# return ( 200 , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , json . dumps ( resp_body ) ) #NEWLINE# #UNINDENT# #UNINDENT# return ( timeout_count , attempts )