Use FastAPI instead of Django
This commit is contained in:
parent
bfe90aa69d
commit
b462be40af
43 changed files with 1105 additions and 1688 deletions
29
app/cli.py
Normal file
29
app/cli.py
Normal 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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue