Exception, wenn Feed nicht erreichbar
This commit is contained in:
parent
2bd88e767a
commit
00e4acfd35
5
bot.py
5
bot.py
@ -318,6 +318,7 @@ def check_rss(bot, job):
|
||||
last = r.get('pythonbot:rss:' + url + ':last_entry')
|
||||
|
||||
feed_data = feedparser.parse(url)
|
||||
try:
|
||||
if feed_data.status < 400:
|
||||
if not 'title' in feed_data.feed:
|
||||
feed_title = feed_data.feed.link
|
||||
@ -378,7 +379,9 @@ def check_rss(bot, job):
|
||||
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('----------')
|
||||
except:
|
||||
print('Fehler: Seite nicht erreichbar')
|
||||
print('-----------------------')
|
||||
|
||||
|
||||
def error(bot, update, error):
|
||||
|
Reference in New Issue
Block a user