aboutsummaryrefslogtreecommitdiff
path: root/manager.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2015-03-04 08:30:08 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2015-03-04 08:30:08 +0100
commita6d1c3fd860cff01510cd63264cb672c677a2e69 (patch)
tree702fb769db8532c64c0a5ac7132105329b053506 /manager.py
parentThe feed abject should be loaded when 'feed_id' is not None. (diff)
downloadnewspipe-a6d1c3fd860cff01510cd63264cb672c677a2e69.tar.gz
newspipe-a6d1c3fd860cff01510cd63264cb672c677a2e69.tar.bz2
newspipe-a6d1c3fd860cff01510cd63264cb672c677a2e69.zip
Test with the old crawler (temporary during the transition).
Diffstat (limited to 'manager.py')
-rwxr-xr-xmanager.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/manager.py b/manager.py
index 89fd2bf1..c139d93b 100755
--- a/manager.py
+++ b/manager.py
@@ -90,6 +90,32 @@ def fetch(user, password, limit=10):
scheduler.run(limit=limit)
scheduler.wait()
+@manager.command
+def fetch_old(user_id, feed_id):
+ "Uses the old crawler (temporary)"
+ with application.app_context():
+ populate_g()
+ from pyaggr3g470r.models import User
+ from pyaggr3g470r import crawler
+ users, feed_id = [], None
+ try:
+ users = User.query.filter(User.id == int(user_id)).all()
+ except:
+ users = User.query.all()
+ finally:
+ if users == []:
+ users = User.query.all()
+
+ try:
+ feed_id = int(feed_id)
+ except:
+ feed_id = None
+
+ for user in users:
+ if user.activation_key == "":
+ print("Fetching articles for " + user.nickname)
+ feed_getter = crawler.retrieve_feed(user, feed_id)
+
if __name__ == '__main__':
manager.run()
bgstack15