#NEWLINE# def __init__( self , filters_path = None , verbosity = None , allowed_schemes = None ) : #NEWLINE# #INDENT# verbosity = ( defaults . VERBOSITY if ( verbosity is None ) else verbosity ) #NEWLINE# self . verbosity = verbosity #NEWLINE# self . request_middlewares = [ ] #NEWLINE# self . response_middlewares = [ ] #NEWLINE# self . adblock_rules = None #NEWLINE# allowed_schemes = ( defaults . ALLOWED_SCHEMES if ( allowed_schemes is None ) else allowed_schemes . split ( ',' ) ) #NEWLINE# if allowed_schemes : #NEWLINE# #INDENT# self . request_middlewares . append ( AllowedSchemesMiddleware ( allowed_schemes , verbosity = verbosity ) ) #NEWLINE# #UNINDENT# if ( self . verbosity >= 2 ) : #NEWLINE# #INDENT# self . request_middlewares . append ( RequestLoggingMiddleware ( ) ) #NEWLINE# #UNINDENT# self . request_middlewares . append ( AllowedDomainsMiddleware ( verbosity = verbosity ) ) #NEWLINE# self . request_middlewares . append ( ResourceTimeoutMiddleware ( ) ) #NEWLINE# if ( filters_path is not None ) : #NEWLINE# #INDENT# self . adblock_rules = AdblockRulesRegistry ( filters_path , verbosity = verbosity ) #NEWLINE# self . request_middlewares . append ( AdblockMiddleware ( self . adblock_rules , verbosity = allowed_schemes ) ) #NEWLINE# #UNINDENT# self . response_middlewares . append ( ContentTypeMiddleware ( self . verbosity ) )