forked from platypush/platypush
Don't fail hard if it was not possible to get the ical content
This commit is contained in:
parent
b3ffb29726
commit
e2f7213697
1 changed files with 13 additions and 2 deletions
|
@ -69,10 +69,21 @@ class IcalCalendarPlugin(Plugin, CalendarInterface):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
events = []
|
events = []
|
||||||
response = requests.get(self.url)
|
try:
|
||||||
|
response = requests.get(self.url)
|
||||||
|
except Exception as e:
|
||||||
|
self.logger.exception(e)
|
||||||
|
return events
|
||||||
|
|
||||||
if response.ok:
|
if response.ok:
|
||||||
calendar = Calendar.from_ical(response.text)
|
calendar = None
|
||||||
|
|
||||||
|
try:
|
||||||
|
calendar = Calendar.from_ical(response.text)
|
||||||
|
except Exception as e:
|
||||||
|
self.logger.exception(e)
|
||||||
|
return events
|
||||||
|
|
||||||
for event in calendar.walk():
|
for event in calendar.walk():
|
||||||
if event.name != 'VEVENT':
|
if event.name != 'VEVENT':
|
||||||
continue # Not an event
|
continue # Not an event
|
||||||
|
|
Loading…
Reference in a new issue