Is your feature request related to a problem? Please describe.
I've been using urlwatch up until now and just discovered this fork. Very nice! One crucial feature that is missing however is support for custom reporters. urlwatch supports this through the --hooks option. While it appears I can also with webchanges specify this option, it later tells me that the corresponding configuration in the file referenced by --config is invalid.
Here is the error that was reported:
ValueError: Unrecognized directive(s) in the configuration file urlwatch-errors.yaml:
report:
custom_slack:
channel: C02PC0NG111
enabled: false
token: xoxb-aaaaaaaaaaa-bbbbbbbbbbbbb-ffffffffffffffffffffffff
Describe the solution you'd like
I would like to be able to configure my custom reporters using the YAML config file as with urlwatch.
Describe alternatives you've considered
If webchanges supports some equivalent alternative that I missed, then that of course also works for me.
Additional context
And for completeness sake here is my hooks.py file:
from datetime import datetime
from slack_sdk import WebClient
from urlwatch import reporters
class CustomSlackReporter(reporters.TextReporter):
"""Custom Slack reporter that uploads diff as file to Slack"""
__kind__ = 'custom_slack'
def submit(self):
text = '\n'.join(super().submit())
if text:
slack_token = self.config['token']
client = WebClient(token=slack_token)
timestamp = datetime.now().strftime("%d.%m.%Y %H:%M:%S")
response = client.files_upload(
channels=self.config['channel'],
filetype="diff",
content=text,
initial_comment="Report " + timestamp,
title=f"report-{datetime.now().strftime('%d.%m.%Y')}.txt"
)
Is your feature request related to a problem? Please describe.
I've been using
urlwatchup until now and just discovered this fork. Very nice! One crucial feature that is missing however is support for custom reporters.urlwatchsupports this through the--hooksoption. While it appears I can also withwebchangesspecify this option, it later tells me that the corresponding configuration in the file referenced by--configis invalid.Here is the error that was reported:
Describe the solution you'd like
I would like to be able to configure my custom reporters using the YAML config file as with
urlwatch.Describe alternatives you've considered
If
webchangessupports some equivalent alternative that I missed, then that of course also works for me.Additional context
And for completeness sake here is my
hooks.pyfile: