import sys from core.feed import Feed, update_feed from core.scheduling import Scheduler if __name__ == "__main__": Scheduler() # feeds = {f.name: f for f in } if len(sys.argv) == 1: print "Re-run using a feed name as argument" for f in Feed.objects(): print " {}".format(f.name) if len(sys.argv) > 1: name = sys.argv[1] f = Feed.objects.get(name=name) print "Running {}...".format(f.name) if update_feed(f.id): print "{}: success!".format(f.name)
import sys import os sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from core.feed import Feed import core.config.celeryimports if __name__ == "__main__": if len(sys.argv) == 1: all_feeds = Feed.objects() print all_feeds exit() elif len(sys.argv) >= 2: all_feeds = [Feed.objects.get(name=sys.argv[1])] for n in all_feeds: print "Testing: {}".format(n) n.update()
import sys import logging from os import path YETI_ROOT = path.normpath(path.dirname(path.dirname(path.abspath(__file__)))) sys.path.append(YETI_ROOT) from core.feed import Feed, update_feed from core.scheduling import Scheduler if __name__ == "__main__": logging.basicConfig(level=logging.DEBUG) Scheduler() if len(sys.argv) == 1: print("Re-run using a feed name as argument") for f in Feed.objects(): print(" {}".format(f.name)) if len(sys.argv) > 1: name = sys.argv[1] f = Feed.objects.get(name=name) print("Running {}...".format(f.name)) if update_feed(f.id): print("{}: success!".format(f.name))
import sys import os sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from core.feed import Feed import core.config.celeryimports if __name__ == '__main__': if len(sys.argv) == 1: all_feeds = Feed.objects() print all_feeds exit() elif len(sys.argv) >= 2: all_feeds = [Feed.objects.get(name=sys.argv[1])] for n in all_feeds: print "Testing: {}".format(n) n.update()