Handle feedparser exception
This commit is contained in:
pare
9ab7d02526
commit
975a752a10
S'han modificat 2 arxius amb 13 adicions i 6 eliminacions
|
@ -3,10 +3,7 @@ import feedparser
|
|||
from mastodon import Mastodon
|
||||
import psycopg2
|
||||
import sys
|
||||
|
||||
###############################################################################
|
||||
# INITIALISATION
|
||||
###############################################################################
|
||||
import time
|
||||
|
||||
# Returns the parameter from the specified file
|
||||
def get_parameter( parameter, file_path ):
|
||||
|
@ -61,7 +58,15 @@ if __name__ == '__main__':
|
|||
|
||||
publish = 0
|
||||
|
||||
try:
|
||||
|
||||
newsfeeds = feedparser.parse(feeds_url)
|
||||
print(newsfeeds.status)
|
||||
|
||||
except:
|
||||
|
||||
print(newsfeeds.status)
|
||||
sys.exit(0)
|
||||
|
||||
for entry in newsfeeds.entries:
|
||||
|
||||
|
@ -111,6 +116,8 @@ if __name__ == '__main__':
|
|||
|
||||
mastodon.status_post(toot_text, in_reply_to_id=None,)
|
||||
|
||||
time.sleep(2)
|
||||
|
||||
#########################################################
|
||||
|
||||
insert_line = 'INSERT INTO feeds(id, link) VALUES (%s, %s)'
|
||||
|
|
Loading…
Referencia en una nova incidència