MCPcopy Create free account
hub / github.com/geekcomputers/Python / DBFetcherGreater

Method DBFetcherGreater

insta_monitering/insta_datafetcher.py:386–415  ·  view source on GitHub ↗
(self, limit, date)

Source from the content-addressed store, hash-verified

384 return ujson.dumps(mainlist)
385
386 def DBFetcherGreater(self, limit, date):
387 mainlist = []
388 postval = {}
389 try:
390 postval["posts"] = None
391 if limit.isdigit() == False and date.isdigit() == False:
392 raise Exception
393 limit = int(limit)
394 date = int(date)
395 if date != 0:
396 doc = (
397 self._collection.find({"date": {"$gt": date}})
398 .sort("date", pymongo.ASCENDING)
399 .limit(limit)
400 )
401 else:
402 doc = (
403 self._collection.find().sort("date", pymongo.ASCENDING).limit(limit)
404 )
405 for i in doc:
406 del i["_id"]
407 mainlist.append(i)
408 postval["posts"] = mainlist
409 postval["status"] = True
410 except Exception as err:
411 print(f"exception : {err}\n")
412 print("error::", sys.exc_info()[1])
413 postval["status"] = False
414 finally:
415 return ujson.dumps(postval)
416
417 def DBFetcherLess(self, limit, date):
418 mainlist = []

Callers 1

getMethod · 0.95

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected