I have these 2 functions that are almost the same:
def handle_keywords(self, scan_id):
keywords = Keyword.objects.all()
for kwrd in keywords:
self.process_rss_url(kwrd.rss, SourceType.GOOGLE_ALERTS, kwrd.id, kwrd.last_scan_time, scan_id)
kwrd.last_scan_time = timezone.now()
kwrd.save()
def handle_rss(self, scan_id):
all_rss = RSS.objects.all()
for rss in all_rss:
self.process_rss_url(rss.feed_url, SourceType.RSS, rss.id, rss.last_scan_time, scan_id)
rss.last_scan_time = timezone.now()
rss.save()
What is a good way to reduce the code duplication?