Ignoriere Feed, wenn HTTP-Code >= 400
This commit is contained in:
parent
919afe252a
commit
4d9a498e50
3
bot.py
3
bot.py
@ -295,6 +295,7 @@ def check_rss(bot, job):
|
||||
last = r.get('pythonbot:rss:' + url + ':last_entry')
|
||||
|
||||
feed_data = feedparser.parse(url)
|
||||
if feed_data.status < 400:
|
||||
if not 'title' in feed_data.feed:
|
||||
feed_title = feed_data.feed.link
|
||||
else:
|
||||
@ -352,6 +353,8 @@ def check_rss(bot, job):
|
||||
r.sadd(v, e.new_chat_id)
|
||||
r.rename('pythonbot:rss:' + receiver, 'pythonbot:rss:' + str(e.new_chat_id))
|
||||
bot.sendMessage(e.new_chat_id, text, parse_mode=ParseMode.HTML, disable_web_page_preview=True)
|
||||
else:
|
||||
print('HTTP-Fehler: ' + str(feed_data.status))
|
||||
print('----------')
|
||||
|
||||
def error(bot, update, error):
|
||||
|
Reference in New Issue
Block a user