added try-except
This commit is contained in:
parent
6f6cb854d2
commit
977b01112e
16
main.py
16
main.py
|
@ -29,6 +29,7 @@ update_archive = True
|
||||||
#############
|
#############
|
||||||
|
|
||||||
def GetPosts(feed):
|
def GetPosts(feed):
|
||||||
|
errored = False
|
||||||
Posts = {}
|
Posts = {}
|
||||||
ToIgnore = []
|
ToIgnore = []
|
||||||
ReadSummary = True
|
ReadSummary = True
|
||||||
|
@ -57,7 +58,15 @@ def GetPosts(feed):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
None
|
None
|
||||||
|
|
||||||
rss = feedparser.parse(URL)
|
try:
|
||||||
|
rss = feedparser.parse(URL)
|
||||||
|
except:
|
||||||
|
print("Could not fetch data for feed: %s" % feed)
|
||||||
|
errored = True
|
||||||
|
|
||||||
|
if errored:
|
||||||
|
return None
|
||||||
|
|
||||||
maximum = len(rss.entries)
|
maximum = len(rss.entries)
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
|
@ -171,7 +180,10 @@ for config in feed_configuration:
|
||||||
posts = {}
|
posts = {}
|
||||||
for feed in rss_feeds:
|
for feed in rss_feeds:
|
||||||
sauce = GetPosts(feed)
|
sauce = GetPosts(feed)
|
||||||
posts[feed] = sauce
|
if sauce == None:
|
||||||
|
rss_feeds.remove(feed)
|
||||||
|
else:
|
||||||
|
posts[feed] = sauce
|
||||||
|
|
||||||
#print(posts)
|
#print(posts)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue