<s> """<STR_LIT>""" <EOL> import MySQLdb <EOL> class Py3status : <EOL> """<STR_LIT:U+0020>""" <EOL> critical = <NUM_LIT:20> <EOL> db = '<STR_LIT>' <EOL> host = '<STR_LIT>' <EOL> password = '<STR_LIT>' <EOL> timeout = <NUM_LIT:5> <EOL> user = '<STR_LIT>' <EOL> warning = <NUM_LIT:15> <EOL> def count_glpi_open_tickets ( self , i3s_output_list , i3s_config ) : <EOL> response = { '<STR_LIT>' : '<STR_LIT>' } <EOL> mydb = MySQLdb . connect ( <EOL> host = self . host , <EOL> user = self . user , <EOL> passwd = self . password , <EOL> db = self . db , <EOL> connect_timeout = self . timeout , <EOL> ) <EOL> mycr = mydb . cursor ( ) <EOL> mycr . execute ( '''<STR_LIT>''' ) <EOL> row = mycr . fetchone ( ) <EOL> if row : <EOL> open_tickets = int ( row [ <NUM_LIT:0> ] ) <EOL> if i3s_config [ '<STR_LIT>' ] : <EOL> if open_tickets > self . critical : <EOL> response . update ( { '<STR_LIT>' : i3s_config [ '<STR_LIT>' ] } ) <EOL> elif open_tickets > self . warning : <EOL> response . update ( <EOL> { '<STR_LIT>' : i3s_config [ '<STR_LIT>' ] } <EOL> ) <EOL> response [ '<STR_LIT>' ] = '<STR_LIT>' % open_tickets <EOL> mydb . close ( ) <EOL> return response <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> """<STR_LIT>""" <EOL> from time import sleep <EOL> x = Py3status ( ) <EOL> config = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } <EOL> while True : <EOL> print ( x . count_glpi_open_tickets ( [ ] , config ) ) <EOL> sleep ( <NUM_LIT:1> ) </s>
