<s> __all__ = [ <EOL> '<STR_LIT>' , <EOL> ] <EOL> class AlertApi ( object ) : <EOL> """<STR_LIT>""" <EOL> def alert ( self , query , name = None , message = None , silenced = False , <EOL> notify_no_data = None , timeout_h = None ) : <EOL> """<STR_LIT>""" <EOL> body = { <EOL> '<STR_LIT>' : query , <EOL> '<STR_LIT>' : silenced , <EOL> } <EOL> if name : <EOL> body [ '<STR_LIT:name>' ] = name <EOL> if message : <EOL> body [ '<STR_LIT:message>' ] = message <EOL> if notify_no_data : <EOL> body [ '<STR_LIT>' ] = notify_no_data <EOL> if timeout_h : <EOL> body [ '<STR_LIT>' ] = timeout_h <EOL> return self . http_request ( '<STR_LIT:POST>' , '<STR_LIT>' , body , <EOL> response_formatter = lambda x : x [ '<STR_LIT:id>' ] , <EOL> ) <EOL> def update_alert ( self , alert_id , query , name = None , message = None , silenced = False , <EOL> notify_no_data = None , timeout_h = None , silenced_timeout_ts = None ) : <EOL> """<STR_LIT>""" <EOL> body = { <EOL> '<STR_LIT>' : query , <EOL> '<STR_LIT>' : silenced , <EOL> } <EOL> if name : <EOL> body [ '<STR_LIT:name>' ] = name <EOL> if message : <EOL> body [ '<STR_LIT:message>' ] = message <EOL> if notify_no_data : <EOL> body [ '<STR_LIT>' ] = notify_no_data <EOL> if timeout_h : <EOL> body [ '<STR_LIT>' ] = timeout_h <EOL> if silenced_timeout_ts : <EOL> body [ '<STR_LIT>' ] <EOL> return self . http_request ( '<STR_LIT>' , '<STR_LIT>' % alert_id , body , <EOL> response_formatter = lambda x : x [ '<STR_LIT:id>' ] , <EOL> ) <EOL> def get_alert ( self , alert_id ) : <EOL> """<STR_LIT>""" <EOL> return self . http_request ( '<STR_LIT:GET>' , '<STR_LIT>' % alert_id ) <EOL> def delete_alert ( self , alert_id ) : <EOL> """<STR_LIT>""" <EOL> return self . http_request ( '<STR_LIT>' , '<STR_LIT>' % alert_id ) <EOL> def get_all_alerts ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . http_request ( '<STR_LIT:GET>' , '<STR_LIT>' , <EOL> response_formatter = lambda x : x [ '<STR_LIT>' ] , <EOL> ) <EOL> def mute_alerts ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . http_request ( '<STR_LIT:POST>' , '<STR_LIT>' ) <EOL> def unmute_alerts ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . http_request ( '<STR_LIT:POST>' , '<STR_LIT>' ) </s>
