comparison link.py @ 38:f3a15a724483

mongo api and up-checking
author drewp@bigasterisk.com
date Sat, 19 Nov 2022 17:05:15 -0800
parents e86642cf7393
children 293a694304b8
comparison
equal deleted inserted replaced
37:bbc2431fd634 38:f3a15a724483
15 15
16 def insertOrUpdate(self, doc): 16 def insertOrUpdate(self, doc):
17 if not doc['href']: 17 if not doc['href']:
18 raise ValueError("no link") 18 raise ValueError("no link")
19 self.extract(doc) 19 self.extract(doc)
20 self.coll.update({'href': doc['href']}, doc, upsert=True, safe=True) 20 self.coll.update({'href': doc['href']}, doc, upsert=True)
21 21
22 def extract(self, doc): 22 def extract(self, doc):
23 forUsers = [] 23 forUsers = []
24 tags = [] 24 tags = []
25 for t in doc.get('tag', '').split(' '): 25 for t in doc.get('tag', '').split(' '):