forked from platypush/platypush
Added guard against null variable names
This commit is contained in:
parent
e9f6d9a8bc
commit
a46ce79f0a
1 changed files with 10 additions and 6 deletions
|
@ -53,14 +53,18 @@ class RssPlugin(RunnablePlugin):
|
||||||
def _get_feed_latest_timestamp_varname(url: str) -> str:
|
def _get_feed_latest_timestamp_varname(url: str) -> str:
|
||||||
return f'LATEST_FEED_TIMESTAMP[{url}]'
|
return f'LATEST_FEED_TIMESTAMP[{url}]'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _get_feed_latest_timestamp(cls, url: str) -> Optional[datetime.datetime]:
|
||||||
|
t = get_plugin('variable').get(
|
||||||
|
cls._get_feed_latest_timestamp_varname(url)
|
||||||
|
).output.get(cls._get_feed_latest_timestamp_varname(url))
|
||||||
|
|
||||||
|
if t:
|
||||||
|
return dateutil.parser.isoparse(t)
|
||||||
|
|
||||||
def _get_latest_timestamps(self) -> dict:
|
def _get_latest_timestamps(self) -> dict:
|
||||||
variable = get_plugin('variable')
|
|
||||||
return {
|
return {
|
||||||
url: dateutil.parser.isoparse(
|
url: self._get_feed_latest_timestamp(url)
|
||||||
variable.get(
|
|
||||||
self._get_feed_latest_timestamp_varname(url)
|
|
||||||
).output.get(self._get_feed_latest_timestamp_varname(url))
|
|
||||||
)
|
|
||||||
for url in self.subscriptions
|
for url in self.subscriptions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue