Use FastAPI instead of Django

This commit is contained in:
Joakim Hellsén 2024-05-21 02:43:53 +02:00
commit b462be40af
No known key found for this signature in database
GPG key ID: D196AE66FEBE1DC9
43 changed files with 1105 additions and 1688 deletions

29
app/cli.py Normal file
View file

@ -0,0 +1,29 @@
from __future__ import annotations
from typing import TYPE_CHECKING
import click
from reader import Reader, UpdateError
from app.dependencies import get_reader
if TYPE_CHECKING:
from reader import UpdatedFeed
@click.command()
def update_feeds() -> None:
"""Update all the feeds."""
click.echo("Updating feeds...")
reader: Reader = get_reader()
for feed in reader.update_feeds_iter():
value: UpdatedFeed | None | UpdateError = feed.value
if value is not None and isinstance(value, UpdateError):
click.echo(f"Error updating {feed.url}: {value}")
else:
click.echo(f"Updated {feed.url}.")
click.echo("Feeds updated.")
if __name__ == "__main__":
update_feeds()