From 04b13e003d6af0de21e6c59e411ffee5b97b6134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 1 Oct 2017 18:50:17 +0200 Subject: New upstream version 2.0.4 --- config_template.py | 74 +++++++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) mode change 100644 => 100755 config_template.py (limited to 'config_template.py') diff --git a/config_template.py b/config_template.py old mode 100644 new mode 100755 index f394e52..02788bd --- a/config_template.py +++ b/config_template.py @@ -1,47 +1,49 @@ -import os.path +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- -# Copyright: (2013-2014) Michael Till Beck +# Copyright: (2013-2017) Michael Till Beck # License: GPL-2.0+ -#We collect xpath snippets at this place: Snippet collection - please feel free to add your own definitions! + +# We collect xpath snippets at this place: +# Snippet collection +# Feel free to contribute! + + +from mwctools import URLReceiver as uri +from mwctools import CommandReceiver as command +from mwctools import XPathParser as xpath +from mwctools import CSSParser as css +from mwctools import RegExParser as regex +from mwctools import Content +from mwctools import Parser + sites = [ - {'shortname': 'mywebsite1', - 'uri': 'http://www.mywebsite1.com/info', - 'type': 'html', - 'titlexpath': '//h1', - 'contentxpath': '//div', - 'titleregex': '', - 'contentregex': '', - 'user-agent': 'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0', - 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' - 'encoding': 'utf-8'}, - - {'shortname': 'mywebsite2', - 'uri': 'http://www.mywebsite2.com/info', - 'type': 'html', - 'contentxpath': '//*[contains(concat(\' \', normalize-space(@class), \' \'), \' news-list-container \')]', - 'regex': '', - 'encoding': 'utf-8'}, - - {'shortname': 'mywebsite3', - 'uri': 'http://www.mywebsite3.com/info', - 'type': 'text', - 'contentxpath': '', - 'contentregex': 'Version\"\:\d*\.\d*', - 'encoding': 'utf-8'}, - - {'shortname': 'lscmd', - 'uri': 'cmd://ls -l /home/pi', - 'contentregex': '.*Desktop.*' - } + {'name': 'example-css', + 'parsers': [uri(uri='https://github.com/mtill', contenttype='html'), + css(contentcss='div') + ] + }, + + {'name': 'example-xpath', + 'parsers': [uri(uri='https://example-webpage.com/test', contenttype='html'), + xpath(contentxpath='//div[contains(concat(\' \', normalize-space(@class), \' \'), \' package-version-header \')]') + ] + }, + + {'name': 'my-script', + 'parsers': [command(command='/home/user/script.sh', contenttype='text'), + regex(contentregex='^.*$') + ] + } ] -subjectPostfix = 'A website has been updated!' +workingDirectory = '/path-to-data-dir/MailWebsiteChanges-data' -enableMailNotifications = True +enableMailNotifications = False maxMailsPerSession = -1 sender = 'me@mymail.com' smtphost = 'mysmtpprovider.com' @@ -51,9 +53,7 @@ smtpusername = sender smtppwd = 'mypassword' receiver = 'me2@mymail.com' -os.chdir('/var/cache/mwc') - -enableRSSFeed = True +enableRSSFeed = False rssfile = 'feed.xml' maxFeeds = 100 -- cgit v1.2.3