Bug fixes

This commit is contained in:
Tanner Collin 2025-02-01 20:31:35 +00:00
parent 249a616531
commit f10e6063fc
3 changed files with 4 additions and 3 deletions

View File

@ -9,6 +9,7 @@ from bs4 import BeautifulSoup
import settings
from feeds import hackernews, reddit, tildes, manual, lobsters
import utils
INVALID_DOMAINS = ['youtube.com', 'bloomberg.com', 'wsj.com', 'sec.gov']
TWO_DAYS = 60*60*24*2

View File

@ -50,7 +50,7 @@ def unix(date_str):
def make_comment(i):
c = {}
try:
c['author'] = i['commenting_user']['username']
c['author'] = i['commenting_user']
except KeyError:
c['author'] = ''
c['score'] = i.get('score', 0)

View File

@ -10,11 +10,11 @@ from bleach.sanitizer import Cleaner
def alert_tanner(message):
try:
logger.info('Alerting Tanner: ' + message)
logging.info('Alerting Tanner: ' + message)
params = dict(qotnews=message)
requests.get('https://tbot.tannercollin.com/message', params=params, timeout=4)
except BaseException as e:
logger.error('Problem alerting Tanner: ' + str(e))
logging.error('Problem alerting Tanner: ' + str(e))
def gen_rand_id():
return ''.join(random.choice(string.ascii_uppercase) for _ in range(4))