def process_unseen_announcements(self): """ Process all unseen announcements """ if not self.unseen_announcements: return # public_companies = ["GWG", "GEWOFAG"] for unseen_announcement in self.unseen_announcements: apartment = unseen_announcement["resultlist.realEstate"] text = ImmoScout.prepare_apartment_notification_text(apartment) # If you are interested only in public companies uncomment the next instructions # is_public = False # if 'realtorCompanyName' in apartment: # company = apartment['realtorCompanyName'].upper() # for c in public_companies: # if company.find(c) != -1: # is_public = True # if is_public: db.insert_to_database({"hash": apartment["@id"]}, collection_name=ImmoScout.COLLECTION_NAME) bot = Bot() bot.push_notification(text=text)
def process_bayernheim_update(self): """ Update database and send notification for BayernHeim update """ db.update_in_database(self.db_obj["_id"], self.hash_obj, collection_name=BayernHeim.COLLECTION_NAME) text = BayernHeim.prepare_bayernheim_text() bot = Bot() bot.push_notification(text=text)