#NEWLINE# def GetTransactionModel( self , transaction ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# response_body = transaction . GetRawResponseBody ( ) . encode ( 'utf-8' ) #NEWLINE# binary_response = False #NEWLINE# #UNINDENT# except UnicodeDecodeError : #NEWLINE# #INDENT# response_body = base64 . b64encode ( transaction . GetRawResponseBody ( ) ) #NEWLINE# binary_response = True #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# transaction_model = models . Transaction ( url = transaction . URL , scope = transaction . InScope ( ) , method = transaction . Method , data = transaction . Data , time = float ( transaction . Time ) , time_human = transaction . TimeHuman , local_timestamp = transaction . LocalTimestamp , raw_request = transaction . GetRawRequest ( ) , response_status = transaction . GetStatus ( ) , response_headers = transaction . GetResponseHeaders ( ) , response_body = response_body , response_size = len ( response_body ) , binary_response = binary_response , session_tokens = transaction . GetSessionTokens ( ) , login = None , logout = None ) #NEWLINE# return transaction_model