Improve logging
This commit is contained in:
parent
0d16bec6f6
commit
4579dfce00
|
@ -10,7 +10,6 @@ from bs4 import BeautifulSoup
|
||||||
from feeds import hackernews, reddit, tildes, manual
|
from feeds import hackernews, reddit, tildes, manual
|
||||||
|
|
||||||
OUTLINE_API = 'https://api.outline.com/v3/parse_article'
|
OUTLINE_API = 'https://api.outline.com/v3/parse_article'
|
||||||
ARCHIVE_API = 'https://archive.fo/submit/'
|
|
||||||
READ_API = 'http://127.0.0.1:33843'
|
READ_API = 'http://127.0.0.1:33843'
|
||||||
|
|
||||||
INVALID_DOMAINS = ['youtube.com', 'bloomberg.com', 'wsj.com']
|
INVALID_DOMAINS = ['youtube.com', 'bloomberg.com', 'wsj.com']
|
||||||
|
@ -72,8 +71,6 @@ def get_content_type(url):
|
||||||
def update_story(story, is_manual=False):
|
def update_story(story, is_manual=False):
|
||||||
res = {}
|
res = {}
|
||||||
|
|
||||||
logging.info('Updating story ' + str(story['ref']))
|
|
||||||
|
|
||||||
if story['source'] == 'hackernews':
|
if story['source'] == 'hackernews':
|
||||||
res = hackernews.story(story['ref'])
|
res = hackernews.story(story['ref'])
|
||||||
elif story['source'] == 'reddit':
|
elif story['source'] == 'reddit':
|
||||||
|
|
|
@ -175,6 +175,8 @@ def feed_thread():
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
story = dict(id=item['sid'], ref=item['ref'], source=item['source'])
|
story = dict(id=item['sid'], ref=item['ref'], source=item['source'])
|
||||||
|
|
||||||
|
logging.info('Updating story: ' + str(story['ref']) + ', index: ' + str(news_index))
|
||||||
|
|
||||||
valid = feed.update_story(story)
|
valid = feed.update_story(story)
|
||||||
if valid:
|
if valid:
|
||||||
database.put_story(story)
|
database.put_story(story)
|
||||||
|
@ -183,7 +185,7 @@ def feed_thread():
|
||||||
database.del_ref(item['ref'])
|
database.del_ref(item['ref'])
|
||||||
logging.info('Removed ref {}'.format(item['ref']))
|
logging.info('Removed ref {}'.format(item['ref']))
|
||||||
else:
|
else:
|
||||||
logging.info('Skipping index')
|
logging.info('Skipping index: ' + str(news_index))
|
||||||
|
|
||||||
gevent.sleep(6)
|
gevent.sleep(6)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user