diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-05-07 20:57:36 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-05-07 20:57:36 +0200 |
commit | 44864324e39b1610f6ce371b20b523c006779a4a (patch) | |
tree | 01b2f02bd7bcfdc8f616457d1c41ac104630e6c7 /debian/patches/0115-Add_header.patch | |
parent | 8decbbc614755cc10ff3f571fd69317a107f10bd (diff) |
new 0115-Add_header.patch
Diffstat (limited to 'debian/patches/0115-Add_header.patch')
-rw-r--r-- | debian/patches/0115-Add_header.patch | 34 |
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 == ''): |