def test_collect_user_feed(): user_id = 90591566 collector = VkCollector(CONFIG) loop = asyncio.get_event_loop() loop.run_until_complete(collector.collect_user_feed(user_id)) loop.stop() loop.close()
''' Console utilities ''' # TODO: temporary hack! To do daemon import os import asyncio import logging import traceback from settings import CONFIG as config from vk.collector import VkCollector pid = os.fork() if pid == 0: collector = VkCollector(config) loop = asyncio.get_event_loop() while True: try: loop.run_until_complete(collector.collect_feeds()) except Exception: logger = logging.getLogger('myfeed.file') logger.error(traceback.format_exc())