From 692f585dd7c5cbccd3aedd27b63950e7f287aeba Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Thu, 29 May 2014 11:07:02 +0200 Subject: fetch.py can now retrieved articles for all user (when no arguments are given). --- fetch.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/fetch.py b/fetch.py index e65fc1b1..38d1ba2f 100644 --- a/fetch.py +++ b/fetch.py @@ -9,6 +9,7 @@ import sys from pyaggr3g470r import crawler +from pyaggr3g470r.models import User if __name__ == "__main__": # Point of entry in execution mode @@ -16,5 +17,14 @@ if __name__ == "__main__": feed_id = int(sys.argv[2]) except: feed_id = None - feed_getter = crawler.FeedGetter(sys.argv[1]) - feed_getter.retrieve_feed(feed_id) + + users = [] + try: + users = User.query.filter(User.email == sys.argv[1]).all() + except: + users = User.query.all() + + for user in users: + print "Fetching articles for", user.nickname + feed_getter = crawler.FeedGetter(user.email) + feed_getter.retrieve_feed(feed_id) -- cgit