[networking] Log error when unable to restart a watch
This commit is contained in:
parent
26515677b8
commit
b44464d255
2 changed files with 14 additions and 6 deletions
|
@ -2,9 +2,12 @@
|
||||||
|
|
||||||
"""Various network tools (w3m, w3c validator, curl, traceurl, ...)"""
|
"""Various network tools (w3m, w3c validator, curl, traceurl, ...)"""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from nemubot.exception import IRCException
|
from nemubot.exception import IRCException
|
||||||
from nemubot.hooks import hook
|
from nemubot.hooks import hook
|
||||||
|
|
||||||
|
logger = logging.getLogger("nemubot.module.networking")
|
||||||
nemubotversion = 3.4
|
nemubotversion = 3.4
|
||||||
|
|
||||||
from more import Response
|
from more import Response
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
"""Alert on changes on websites"""
|
"""Alert on changes on websites"""
|
||||||
|
|
||||||
|
import logging
|
||||||
from random import randint
|
from random import randint
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
@ -9,6 +10,7 @@ from nemubot.exception import IRCException
|
||||||
from nemubot.hooks import hook
|
from nemubot.hooks import hook
|
||||||
from nemubot.tools.xmlparser.node import ModuleState
|
from nemubot.tools.xmlparser.node import ModuleState
|
||||||
|
|
||||||
|
logger = logging.getLogger("nemubot.module.networking.watchWebsite")
|
||||||
nemubotversion = 3.4
|
nemubotversion = 3.4
|
||||||
|
|
||||||
from more import Response
|
from more import Response
|
||||||
|
@ -187,9 +189,12 @@ def start_watching(site, offset=0):
|
||||||
o = urlparse(site["url"], "http")
|
o = urlparse(site["url"], "http")
|
||||||
#print_debug("Add %s event for site: %s" % (site["type"], o.netloc))
|
#print_debug("Add %s event for site: %s" % (site["type"], o.netloc))
|
||||||
|
|
||||||
evt = ModuleEvent(func=lambda url: page.render(url, None),
|
try:
|
||||||
cmp_data=site["lastcontent"],
|
evt = ModuleEvent(func=lambda url: page.render(url, None),
|
||||||
func_data=site["url"], offset=offset,
|
cmp_data=site["lastcontent"],
|
||||||
interval=site.getInt("time"),
|
func_data=site["url"], offset=offset,
|
||||||
call=alert_change, call_data=site)
|
interval=site.getInt("time"),
|
||||||
site["_evt_id"] = add_event(evt)
|
call=alert_change, call_data=site)
|
||||||
|
site["_evt_id"] = add_event(evt)
|
||||||
|
except IRCException:
|
||||||
|
logger.exception("Unable to watch %s", site["url"])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue