32 lines
624 B
Python
32 lines
624 B
Python
import requests
|
|
|
|
from rwx import Object, txt
|
|
from rwx.txt import CHARSET
|
|
|
|
|
|
def fetch(url: str) -> str:
|
|
response = requests.get(url)
|
|
response.raise_for_status()
|
|
return response.text
|
|
|
|
|
|
class Page(Object):
|
|
def __init__(self):
|
|
self.charset = CHARSET
|
|
self.description = ""
|
|
self.title = ""
|
|
|
|
def render(self) -> str:
|
|
return f"""\
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="{self.charset}">
|
|
<meta name="description" content="{self.description}">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>{self.title}</title>
|
|
</head>
|
|
<body>
|
|
</body>
|
|
</html>
|
|
"""
|