aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2015-05-27 10:35:19 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2015-05-27 10:35:19 +0200
commit7601b31fcd12422d84ea0d1618bad98b74d35d7b (patch)
treef9bec063c3f6633a15b53876764237499db9a1d6 /pyaggr3g470r
parentNo need to set feed.enabled in the asyncio crawler. Just to increase the coun... (diff)
downloadnewspipe-7601b31fcd12422d84ea0d1618bad98b74d35d7b.tar.gz
newspipe-7601b31fcd12422d84ea0d1618bad98b74d35d7b.tar.bz2
newspipe-7601b31fcd12422d84ea0d1618bad98b74d35d7b.zip
Try to fix a problem with Python 3.4.3 and test 'ensure_future' with Python dev (3.5).
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r--pyaggr3g470r/crawler.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/pyaggr3g470r/crawler.py b/pyaggr3g470r/crawler.py
index e5a7966f..cada119b 100644
--- a/pyaggr3g470r/crawler.py
+++ b/pyaggr3g470r/crawler.py
@@ -242,8 +242,13 @@ def retrieve_feed(user, feed_id=None):
# Launch the process for all the feeds
loop = asyncio.get_event_loop()
- tasks = [init_process(user, feed) for feed in feeds]
- #tasks = [asyncio.async(init_process(user, feed)) for feed in feeds]
+ tasks = []
+ try:
+ # Python 3.5 (test)
+ tasks = [asyncio.ensure_future(init_process(user, feed)) for feed in feeds]
+ except:
+ tasks = [init_process(user, feed) for feed in feeds]
loop.run_until_complete(asyncio.wait(tasks))
+ loop.close()
logger.info("All articles retrieved. End of the processus.")
bgstack15