<s> from twisted . web . client import HTTPPageGetter <EOL> from pymon . clients import ClientMixin <EOL> from pymon . utils . logger import log <EOL> from pymon . workflow import rules <EOL> class HttpStatusClient ( HTTPPageGetter , ClientMixin ) : <EOL> def connectionMade ( self ) : <EOL> HTTPPageGetter . connectionMade ( self ) <EOL> ClientMixin . connectionMade ( self ) <EOL> def connectionLost ( self , reason ) : <EOL> status = self . factory . status <EOL> if status : <EOL> status = int ( status ) <EOL> log . debug ( str ( dir ( self . factory ) ) ) <EOL> log . debug ( str ( self . factory . headers ) ) <EOL> log . debug ( str ( self . factory . response_headers ) ) <EOL> checked_resource = self . factory . checkConfig . uri <EOL> self . rules . check ( status ) <EOL> self . rules . setMsg ( checked_resource , status , self . factory . message ) <EOL> self . rules . setSubj ( checked_resource , status ) <EOL> if self . rules . isSendMessage ( ) : <EOL> self . rules . sendIt ( ) <EOL> log . debug ( '<STR_LIT>' % self . factory . uid ) <EOL> log . info ( self . rules . msg ) <EOL> log . info ( self . rules . subj ) <EOL> log . debug ( "<STR_LIT>" % ( status , self . getHost ( ) ) ) <EOL> self . updateState ( ) <EOL> log . debug ( '<STR_LIT>' + str ( self . factory . state . data ) + '<STR_LIT:\n>' ) </s>
