Skip to content

rss

This package consists of a simple RSS -> ActivityPub bridge made with cattle_grid.

Development

You can run tests via

uv run pytest

or run them in watch mode via uv run ptw.

Docker Compose

Simply running

docker compose up

in this project will lead to errors. This is due to rss being a layer on top of cattle_grid, of which we assume the corresponding docker compose up is running in the background.

Updating the feeds

This can be done by running

docker compose exec rss uv run python -mrss

behave

To run the features, run

docker compose run rss_runner

and in it uv run behave. For these cattle_grid will generate reports. See cattle_grid_reports for some examples (their names contain RSS and are not super useful).

For these tests to run, one needs to enable testing_mode. This can be done by creating the file

rss.toml
testing_mode = true

rss

create_app()

Usage via

uv run uvicorn --factory rss:create_app
Source code in rss/__init__.py
def create_app():
    """Usage via

    ```shell
    uv run uvicorn --factory rss:create_app
    ```
    """
    config = load_config()
    app = Quart(__name__, template_folder="web/templates")
    app.jinja_options = {"auto_reload": config.testing_mode}

    app.config["config"] = config

    app.register_blueprint(blueprint)
    register_tortoise(
        app,
        db_url=config.db_uri,
        modules={
            "rss_models": ["rss.models"],
        },
        generate_schemas=True,
    )

    @app.while_serving
    async def lifecycle():
        async with aiohttp.ClientSession() as session:
            async with connect(config.cattle_drive_uri) as connection:
                app.config["session"] = session
                app.config["cattle_drive"] = connection
                yield

    return app