Coverage for an_website / kangaroo_comics / comics.py: 92.857%

14 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-05 08:06 +0000

1# This program is free software: you can redistribute it and/or modify 

2# it under the terms of the GNU Affero General Public License as 

3# published by the Free Software Foundation, either version 3 of the 

4# License, or (at your option) any later version. 

5# 

6# This program is distributed in the hope that it will be useful, 

7# but WITHOUT ANY WARRANTY; without even the implied warranty of 

8# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

9# GNU Affero General Public License for more details. 

10# 

11# You should have received a copy of the GNU Affero General Public License 

12# along with this program. If not, see <https://www.gnu.org/licenses/>. 

13 

14"""A page with the kangaroo comics by Zeit Online.""" 

15 

16 

17from ..utils.request_handler import HTMLRequestHandler 

18from ..utils.utils import ModuleInfo 

19 

20 

21def get_module_info() -> ModuleInfo: 

22 """Create and return the ModuleInfo for this module.""" 

23 return ModuleInfo( 

24 handlers=( 

25 (r"/kaenguru-comics", KangarooComicsRedirect), 

26 (r"/kaenguru-comics-alt", KangarooComics), 

27 ), 

28 name="Känguru-Comics", 

29 description=( 

30 "Känguru-Comics von Zeit Online, Marc-Uwe Kling und Bernd Kissel" 

31 ), 

32 path="/kaenguru-comics", 

33 keywords=("Känguru", "Comics", "Zeit", "Marc-Uwe Kling"), 

34 aliases=( 

35 "/kangaroo-comics", 

36 "/comics", 

37 "/känguru-comics", 

38 "/k%C3%A4nguru-comics", 

39 ), 

40 ) 

41 

42 

43class KangarooComicsRedirect(HTMLRequestHandler): 

44 """Request handler for the kangaroo comics redirect.""" 

45 

46 async def get(self, *, head: bool = False) -> None: 

47 """Handle GET requests to the kangaroo comics page.""" 

48 if head: 

49 return 

50 await self.render( 

51 "pages/redirect.html", 

52 send_referrer=False, 

53 redirect_url="https://www.zeit.de/serie/die-kaenguru-comics", 

54 from_url=self.fix_url("/kaenguru-comics-alt"), 

55 back_button_text="Comics hier lesen (nicht empfohlen)", 

56 discord=False, 

57 ) 

58 

59 

60class KangarooComics(HTMLRequestHandler): 

61 """Request handler for the kangaroo comics page.""" 

62 

63 async def get(self, *, head: bool = False) -> None: 

64 """Handle GET requests to the kangaroo comics page.""" 

65 if head: 

66 return 

67 await self.render("pages/kangaroo_comics.html")