added namings to feeds

This commit is contained in:
bvn13 2024-10-16 01:40:23 +03:00
parent de5b3ad932
commit 4cc4e7922e
4 changed files with 6 additions and 5 deletions

View File

@ -48,7 +48,7 @@ def _start_scheduling():
time.sleep(1)
def _start_web_server():
start_server(args=args)
start_server(args=args, settings=settings)
if __name__ == "__main__":

View File

@ -17,7 +17,7 @@ def fetch(settings: list, args: Namespace) -> None:
s = Session()
retries = Retry(
total=3,
backoff_factor=0.1,
backoff_factor=0.2,
status_forcelist=[502, 503, 504],
allowed_methods={'GET'},
)

View File

@ -5,11 +5,12 @@ import tornado
from src.logger import logger as l
def start_server(args: Namespace) -> None:
def start_server(settings: list, args: Namespace) -> None:
logger = l.getChild(__name__)
def _get_all_feeds():
return [{ 'rss': f, 'file': f"/feeds/{f}" } for f in fnmatch.filter(os.listdir(args.directory), '*.xml')]
return [{ 'rss': sets['name'], 'file': f"/feeds/{sets['rss']}" } for sets in settings if os.path.isfile(f"{args.directory}/{sets['rss']}")]
# return [{ 'rss': f, 'file': f"/feeds/{f}" } for f in fnmatch.filter(os.listdir(args.directory), '*.xml')]
class MainHandler(tornado.web.RequestHandler):
def set_default_headers(self):

View File

@ -6,7 +6,7 @@
</head>
<body>
<div id="body">
<p>Feeds:</p>
<h1>Feeds available:</h1>
<ol>
{% for feed in feeds %}
{% module Template("feed.html", feed=feed) %}