From 93b5b36903dc03ce8cb32c7da9f31980abe1e605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gl=C3=BCpker?= Date: Wed, 1 May 2024 09:51:32 +0200 Subject: Remove zammad --- webapp.py | 6 ------ zammad.py | 52 ---------------------------------------------------- 2 files changed, 58 deletions(-) delete mode 100755 zammad.py diff --git a/webapp.py b/webapp.py index 552c4a9..84ded9a 100755 --- a/webapp.py +++ b/webapp.py @@ -18,7 +18,6 @@ from flask import Flask, Response from netto import netto from rss import buildRSS from twitter import twitter -from zammad import zammad from zdf import zdf app = Flask(__name__) @@ -71,11 +70,6 @@ def filterZDFFeed(feed): return rssResponse(zdf(feed)) -@app.route("/zammad") -def filterZammadFeed(): - return rssResponse(zammad()) - - if __name__ == "__main__": logging.basicConfig(filename="./main.log", level=logging.INFO) diff --git a/zammad.py b/zammad.py deleted file mode 100755 index fd0401a..0000000 --- a/zammad.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python3 -import logging -from datetime import datetime -from urllib.request import Request, urlopen - -from bs4 import BeautifulSoup - - -def zammad(): - url = "https://zammad.com/en/releases" - try: - res = urlopen(Request(url)) - except Exception as exc: - logging.error("Request to zammad failed.", exc_info=exc) - return None - - try: - soup = BeautifulSoup(res, features="html.parser") - except Exception as exc: - logging.error("Parsing to zammad failed.", exc_info=exc) - return None - - releases = soup.find_all("a", attrs={"class": "press-article"}) - return { - "title": "Zammad Release Notes", - "url": url, - "description": "Release Notes for Zammad.", - "content": [ - { - "title": release.find(attrs={"class": "press-article-title"}).text, - "url": release.attrs.get("href"), - "content": release.find("p").text, - "date": datetime.strptime( - " ".join( - release.find( - attrs={"class": "press-article-detail"} - ).text.split()[:3] - ), - "%d %B %Y", - ), - } - for release in releases - ], - } - - -def main(): - print(zammad()) - - -if __name__ == "__main__": - main() -- cgit v1.2.3