diff --git a/munin/consommables_hp b/munin/consommables_hp index 39baec56..54b27270 100755 --- a/munin/consommables_hp +++ b/munin/consommables_hp @@ -20,16 +20,16 @@ COLOR_INFOS = { COLORS = COLOR_INFOS.keys() CONS_CLASS_BLOCK = { - color: re.compile(".*consumable-block-"+color.capitalize() +".*") + color: re.compile(".*gauge "+color.capitalize() +".*") for color in COLORS } def ffindconsomable(color, raw): """Retrouve la couleur `color` dans raw""" couleur=raw.findAll('div', attrs={"class":CONS_CLASS_BLOCK[color]}) - couleur_toner=couleur[0].findAll('p',attrs={"class":'data percentage'})[0].string + couleur_toner=couleur[0].findAll('span')[0].string couleur_toner=couleur_toner.split('%')[0] - couleur_tambour=couleur[1].findAll('p',attrs={"class":'data percentage'})[0].string + couleur_tambour=couleur[1].findAll('span')[0].string couleur_tambour=couleur_tambour.split('%')[0] try: couleur_tambour=re.sub('[^\.0-9]', '', couleur_tambour.decode()) @@ -56,7 +56,7 @@ if __name__ == '__main__': else: page = requests.get(URL, verify=CA) raw=BeautifulSoup.BeautifulSoup(page.text) - + for color in COLORS: toner, tambour = ffindconsomable(color, raw) print('{}_toner.value {}'.format(color, toner))