<s> """<STR_LIT>""" <EOL> from twisted . internet import reactor <EOL> from scrapy . utils . misc import load_object <EOL> from scrapy . utils . python import to_unicode <EOL> class HTTP10DownloadHandler ( object ) : <EOL> def __init__ ( self , settings ) : <EOL> self . HTTPClientFactory = load_object ( settings [ '<STR_LIT>' ] ) <EOL> self . ClientContextFactory = load_object ( settings [ '<STR_LIT>' ] ) <EOL> def download_request ( self , request , spider ) : <EOL> """<STR_LIT>""" <EOL> factory = self . HTTPClientFactory ( request ) <EOL> self . _connect ( factory ) <EOL> return factory . deferred <EOL> def _connect ( self , factory ) : <EOL> host , port = to_unicode ( factory . host ) , factory . port <EOL> if factory . scheme == b'<STR_LIT>' : <EOL> return reactor . connectSSL ( host , port , factory , <EOL> self . ClientContextFactory ( ) ) <EOL> else : <EOL> return reactor . connectTCP ( host , port , factory ) </s>
