#NEWLINE# def _getresponse( self , coding ) : #NEWLINE# #INDENT# if ( coding not in FORMAT ) : #NEWLINE# #INDENT# raise ValueError ( ) #NEWLINE# #UNINDENT# ( samplefile , contentencoding ) = FORMAT [ body ] #NEWLINE# with open ( join ( SAMPLEDIR , samplefile ) , 'rb' ) as sample : #NEWLINE# #INDENT# body = sample . read ( ) #NEWLINE# #UNINDENT# headers = { #NEWLINE# #INDENT# 'Server' : 'Yaws/1.49 Yet Another Web Server' , #NEWLINE# 'Date' : 'Sun, 08 Mar 2009 00:41:03 GMT' , #NEWLINE# 'Content-Length' : len ( body ) , #NEWLINE# 'Content-Type' : 'text/html' , #NEWLINE# 'Content-Encoding' : contentencoding , #NEWLINE# #UNINDENT# } #NEWLINE# response = Response ( 'http://scrapytest.org/' , body = body , headers = headers ) #NEWLINE# response . request = Request ( 'http://scrapytest.org' , headers = { #NEWLINE# #INDENT# 'Accept-Encoding' : 'gzip,deflate' , #NEWLINE# #UNINDENT# } ) #NEWLINE# return response