libs/status.py
def insert_status(self, db):
        """
        Insert this instance to DB as a new row. Its side effect is to update WebsiteStatus::last_url_status cache.
        :param db: DB connection
        """
        sql = f'''INSERT INTO web_activity_{self.topic} (topic_offset, test_from, url,
        event_time, status, phrase, dns, response, detail) VALUES (
        {self["offset"]}, '{self["from"]}', '{self["url"]}', {int(self["timestamp"])},
        '{self["status"]}', '{self["phrase"]}', {self["dns"] if self["dns"] else -1},
        {self["response"] if self["response"] else -1}, '{self["detail"]}'
        );'''
        last_id_sql = 'SELECT LASTVAL();'
        with db.cursor() as curs:
            curs.execute(sql)
            curs.execute(last_id_sql)
            r = curs.fetchone()
            if r:  # This should always meet, just to make sure.
                self.last_url_status[self['url']] = (self.healthy(), r[0])

        db.commit()

        Insert this instance to DB as a new row. Its side effect is to update WebsiteStatus::last_url_status cache.
        :param db: DB connection
        
Insert this instance to DB as a new row. Its side effect is to update WebsiteStatus::last_url_status cache.
Insert this instance to DB as a new row . Its side effect is to update WebsiteStatus :: last_url_status cache .
def insert_status(self, db):
        sql = f'''INSERT INTO web_activity_{self.topic} (topic_offset, test_from, url,
        event_time, status, phrase, dns, response, detail) VALUES (
        {self["offset"]}, '{self["from"]}', '{self["url"]}', {int(self["timestamp"])},
        '{self["status"]}', '{self["phrase"]}', {self["dns"] if self["dns"] else -1},
        {self["response"] if self["response"] else -1}, '{self["detail"]}'
        );'''
        last_id_sql = 'SELECT LASTVAL();'
        with db.cursor() as curs:
            curs.execute(sql)
            curs.execute(last_id_sql)
            r = curs.fetchone()
            if r:  
                self.last_url_status[self['url']] = (self.healthy(), r[0])
        db.commit()
def insert_status ( self , db ) : sql = f'''INSERT INTO web_activity_{self.topic} (topic_offset, test_from, url,
        event_time, status, phrase, dns, response, detail) VALUES (
        {self["offset"]}, '{self["from"]}', '{self["url"]}', {int(self["timestamp"])},
        '{self["status"]}', '{self["phrase"]}', {self["dns"] if self["dns"] else -1},
        {self["response"] if self["response"] else -1}, '{self["detail"]}'
        );''' last_id_sql = 'SELECT LASTVAL();' with db . cursor ( ) as curs : curs . execute ( sql ) curs . execute ( last_id_sql ) r = curs . fetchone ( ) if r : self . last_url_status [ self [ 'url' ] ] = ( self . healthy ( ) , r [ 0 ] ) db . commit ( )
Insert this instance to DB as a new row.
Insert this instance to DB as a new row .
"""
        Insert this instance to DB as a new row. Its side effect is to update WebsiteStatus::last_url_status cache.
        :param db: DB connection
        """ # This should always meet, just to make sure.
self
db
None