Exemplo n.º 1
0
 def __init__(self, app, user, passwd):
     Service.__init__(self, app, user, passwd)
     # Os campos do formulário
     self.fields = {}
     self.fields['uid'] = user
     self.fields['pwd'] = passwd
     #Inicialização
     cookies = cookielib.CookieJar() #cookies são necessários para a autenticação
     self.opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookies))
     # Expressão regular para extrair os dados do consumo
     self.pattern = re.compile(r"\|\s*(\d{2}\/\d{2}\/\d{4}\s+\d{2}\:\d{2}\:\d{2})" +
                               r"\s*(\d+(?:\,\d+)?)\s*([KMG])Bytes\s*=\s*(\d+(?:\.\d+)?)\%",
                               re.MULTILINE | re.IGNORECASE)
Exemplo n.º 2
0
 def __init__(self, app, user, passwd):
     Service.__init__(self, app, user, passwd)
     self.haveNotify = False
     self.lastMsgs = set()
     self.newMailIcon = 'mail-unread.svg'
     try:
         self.notify = __import__('pynotify')
         if self.notify.init("Monitors"):
             self.haveNotify = True
             self.notifyCaps = self.notify.get_server_caps()
         else:
             print "There was a problem initializing the pynotify module"
     except:
         print "You don't seem to have pynotify installed"
Exemplo n.º 3
0
 def __init__(self, app, user, passwd):
     Service.__init__(self, app, user, passwd)
     # Os campos do formulário
     self.fields = {}
     self.fields['tx_cpf'] = user
     self.fields['tx_senha'] = passwd
     #Inicialização
     self.opener, self.cookiejar = self.buildOpener()
     self.tempOpener = None
     self.tempCookiejar = None
     #Atualiza a cada 5min
     self.refreshMinutes = 5
     self.lastPageId = None
     self.logged = False
     self.captchaValue = None