From f0f97999ba33351e3d011e73449896b1fab0dd9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 13 May 2017 23:21:52 +0200 Subject: New upstream version 1.7.5 --- README.md | 3 +++ config_template.py | 2 ++ mwc.py | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6c6d731..d008527 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,9 @@ sites = [ * user-agent (optional) Defines the user agent string, e.g., 'user-agent': 'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0' + * accept (optional) + Defines the accept string, e.g., + 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' * We collect some XPath/CSS snippets at this place: Snippet collection - please feel free to add your own definitions! diff --git a/config_template.py b/config_template.py index d7069bb..02f7579 100644 --- a/config_template.py +++ b/config_template.py @@ -14,6 +14,8 @@ sites = [ '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', diff --git a/mwc.py b/mwc.py index 606f504..a0635a1 100755 --- a/mwc.py +++ b/mwc.py @@ -90,6 +90,8 @@ def parseSite(site): req = urllib.request.Request(uri) if 'user-agent' in site: req.add_header('User-Agent', site['user-agent']) + if 'accept' in site: + req.add_header('Accept', site['accept']) file = urllib.request.urlopen(req) @@ -228,7 +230,8 @@ def sendmail(receiver, subject, content, sendAsHtml, link): if config.useTLS: mailsession.ehlo() mailsession.starttls() - mailsession.login(config.smtpusername, config.smtppwd) + if config.smtpusername is not None: + mailsession.login(config.smtpusername, config.smtppwd) mailsession.sendmail(config.sender, receiver.split(','), mail.as_string()) -- cgit v1.2.3