<s> """<STR_LIT>""" <EOL> import requests <EOL> from time import time <EOL> class Py3status : <EOL> """<STR_LIT:U+0020>""" <EOL> app_key = '<STR_LIT>' <EOL> cache_timeout = <NUM_LIT> <EOL> checks = '<STR_LIT>' <EOL> login = '<STR_LIT>' <EOL> max_latency = <NUM_LIT> <EOL> password = '<STR_LIT>' <EOL> request_timeout = <NUM_LIT:15> <EOL> def pingdom_checks ( self , i3s_output_list , i3s_config ) : <EOL> response = { '<STR_LIT>' : '<STR_LIT>' } <EOL> if not isinstance ( self . checks , list ) : <EOL> self . checks = self . checks . split ( '<STR_LIT:U+002C>' ) <EOL> r = requests . get ( <EOL> '<STR_LIT>' , <EOL> auth = ( self . login , self . password ) , <EOL> headers = { '<STR_LIT>' : self . app_key } , <EOL> timeout = self . request_timeout , <EOL> ) <EOL> result = r . json ( ) <EOL> if '<STR_LIT>' in result : <EOL> for check in [ <EOL> ck for ck in result [ '<STR_LIT>' ] if ck [ '<STR_LIT:name>' ] in self . checks <EOL> ] : <EOL> if check [ '<STR_LIT:status>' ] == '<STR_LIT>' : <EOL> response [ '<STR_LIT>' ] += '<STR_LIT>' . format ( <EOL> check [ '<STR_LIT:name>' ] , <EOL> check [ '<STR_LIT>' ] <EOL> ) <EOL> if check [ '<STR_LIT>' ] > self . max_latency : <EOL> response . update ( <EOL> { '<STR_LIT>' : i3s_config [ '<STR_LIT>' ] } <EOL> ) <EOL> else : <EOL> response [ '<STR_LIT>' ] += '<STR_LIT>' . format ( <EOL> check [ '<STR_LIT:name>' ] , <EOL> check [ '<STR_LIT>' ] <EOL> ) <EOL> response . update ( { '<STR_LIT>' : i3s_config [ '<STR_LIT>' ] } ) <EOL> response [ '<STR_LIT>' ] = response [ '<STR_LIT>' ] . strip ( '<STR_LIT:U+002CU+0020>' ) <EOL> response [ '<STR_LIT>' ] = time ( ) + self . cache_timeout <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 . pingdom_checks ( [ ] , config ) ) <EOL> sleep ( <NUM_LIT:1> ) </s>
