summaryrefslogtreecommitdiff
path: root/debian/patches/0115-Add_header.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/0115-Add_header.patch')
-rw-r--r--debian/patches/0115-Add_header.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/debian/patches/0115-Add_header.patch b/debian/patches/0115-Add_header.patch
new file mode 100644
index 0000000..b9fc54e
--- /dev/null
+++ b/debian/patches/0115-Add_header.patch
@@ -0,0 +1,34 @@
+Description: Add Header User-agent and Accept
+Author: Jörg Frings-Fürst <debian@jff-webhosting.net>
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=862004
+Forwarded: https://github.com/Debianguru/MailWebsiteChanges/issues/11
+Last-Update: 2017-05-07
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/mwc.py
+===================================================================
+--- trunk.orig/mwc.py
++++ trunk/mwc.py
+@@ -68,6 +68,8 @@ def parseSite(site):
+ contenttype = site.get('type', 'html')
+ contentregex = site.get('contentregex', '')
+ titleregex = site.get('titleregex', '')
++ UserAgent = site.get('User-agent', '')
++ Accept = site.get('Accept', '')
+ enc = site.get('encoding', defaultEncoding)
+
+ contentxpath = site.get('contentxpath', '')
+@@ -86,7 +88,12 @@ def parseSite(site):
+ file = process.stdout
+ else:
+ # open website
+- file = urllib.request.urlopen(uri)
++ req = urllib.request.Request(uri)
++ if UserAgent != '':
++ req.add_header('User-agent', UserAgent)
++ if Accept != '':
++ req.add_header('Accept', Accept)
++ file = urllib.request.urlopen(req)
+
+
+ if contenttype == 'text' or (contentxpath == '' and titlexpath == ''):