summaryrefslogtreecommitdiff
path: root/webapp.py
diff options
context:
space:
mode:
authorAndré Glüpker <git@wgmd.de>2021-05-09 20:15:36 +0200
committerAndré Glüpker <git@wgmd.de>2021-05-09 20:23:18 +0200
commit9fff75d7016b29715c2413febf6f86d7f444f52c (patch)
treefdb81e5617e355eda2ba3daba90d61cacaaf5d9f /webapp.py
parent93f3613dab38125d9ae7d5e74498c5395ac80ab0 (diff)
downloadrss-feeds-9fff75d7016b29715c2413febf6f86d7f444f52c.tar.gz
rss-feeds-9fff75d7016b29715c2413febf6f86d7f444f52c.tar.bz2
rss-feeds-9fff75d7016b29715c2413febf6f86d7f444f52c.zip
Unify methods
Diffstat (limited to 'webapp.py')
-rwxr-xr-xwebapp.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/webapp.py b/webapp.py
index 332cfc6..62a1bdf 100755
--- a/webapp.py
+++ b/webapp.py
@@ -25,20 +25,26 @@ app = Flask(__name__)
app.secret_key = "NMcgoB.0wd+$.KVKj!F{3>U{%BBUVhL=7=5$:46rQH$Q{enCuU"
+def rssResponse(data):
+ rss = buildRSS(data)
+ response = Response(rss, mimetype='text/xml')
+ response.headers['Access-Control-Allow-Origin'] = '*'
+ return response
+
+
@app.route("/")
def main():
return 'this is sparta'
+
@app.errorhandler(404)
def not_found(e):
return 'Die angeforderte Seite konnte nicht gefunden werden.'
+
@app.route("/twitter/<account>")
def feedTwitter(account):
- xml = buildRSS(twitter(account))
- response = Response(xml, mimetype='text/xml')
- response.headers['Access-Control-Allow-Origin'] = '*'
- return response
+ return rssResponse(twitter(account))
# @app.route("/telegram/<account>")
# def feedTelegram(account):
@@ -55,17 +61,12 @@ def feedTwitter(account):
@app.route("/netto/<market>")
def feedNetto(market):
- xml = buildRSS(netto(market))
- response = Response(xml, mimetype='text/xml')
- response.headers['Access-Control-Allow-Origin'] = '*'
- return response
+ return rssResponse(netto(market))
+
@app.route("/zdf/<path:feed>")
def filterZDFFeed(feed):
- xml = buildRSS(zdf(feed))
- response = Response(xml, mimetype='text/xml')
- response.headers['Access-Control-Allow-Origin'] = '*'
- return response
+ return rssResponse(zdf(feed))
if __name__ == '__main__':