#NEWLINE# def restore_response( self , response , seen = None ) : #NEWLINE# #INDENT# ' Restore response object after unpickling\n        ' #NEWLINE# if ( seen is None ) : #NEWLINE# #INDENT# seen = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# return seen [ id ( response ) ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# result = requests . Response ( ) #NEWLINE# for field in self . _response_attrs : #NEWLINE# #INDENT# setattr ( result , field , getattr ( response , field , None ) ) #NEWLINE# #UNINDENT# result . raw . _cached_content_ = result . content #NEWLINE# seen [ id ( response ) ] = result #NEWLINE# result . history = tuple ( ( self . restore_response ( r , seen ) for r in response . history ) ) #NEWLINE# return result