From 62c2f929d69ec1c6fcaaf1e2cde29c88cdb86679 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 22 Oct 2024 21:54:29 +0100 Subject: [PATCH] Remove cache For this use case, it's unnecessary --- main.py | 10 +++------- pyproject.toml | 1 - uv.lock | 11 ----------- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/main.py b/main.py index 723d4d1..b9bea58 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,3 @@ -from aiocache import cached from bs4 import BeautifulSoup from httpx import AsyncClient from starlette.applications import Starlette @@ -11,13 +10,10 @@ client = AsyncClient() FEED_URL = "https://lwn.net/headlines/rss" -@cached(ttl=3600) -async def get_feed() -> str: - return (await client.get(FEED_URL)).content - - async def index(request: Request) -> Response: - raw_feed = await get_feed() + feed_response = await client.get(FEED_URL) + + raw_feed = await feed_response.aread() feed = BeautifulSoup(raw_feed, "xml") diff --git a/pyproject.toml b/pyproject.toml index 3f0a9c6..0577173 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,6 @@ description = "Add your description here" readme = "README.md" requires-python = ">=3.10" dependencies = [ - "aiocache>=0.12.3", "beautifulsoup4>=4.12.3", "granian[reload]>=1.6.1", "httpx>=0.27.2", diff --git a/uv.lock b/uv.lock index 59c842b..112dcdd 100644 --- a/uv.lock +++ b/uv.lock @@ -1,15 +1,6 @@ version = 1 requires-python = ">=3.10" -[[package]] -name = "aiocache" -version = "0.12.3" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/7a/64/b945b8025a9d1e6e2138845f4022165d3b337f55f50984fbc6a4c0a1e355/aiocache-0.12.3.tar.gz", hash = "sha256:f528b27bf4d436b497a1d0d1a8f59a542c153ab1e37c3621713cb376d44c4713", size = 132196 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/37/d7/15d67e05b235d1ed8c3ce61688fe4d84130e72af1657acadfaac3479f4cf/aiocache-0.12.3-py2.py3-none-any.whl", hash = "sha256:889086fc24710f431937b87ad3720a289f7fc31c4fd8b68e9f918b9bacd8270d", size = 28199 }, -] - [[package]] name = "anyio" version = "4.6.2.post1" @@ -180,7 +171,6 @@ name = "lwn-proxy" version = "0.0.0" source = { virtual = "." } dependencies = [ - { name = "aiocache" }, { name = "beautifulsoup4" }, { name = "granian", extra = ["reload"] }, { name = "httpx" }, @@ -195,7 +185,6 @@ dev = [ [package.metadata] requires-dist = [ - { name = "aiocache", specifier = ">=0.12.3" }, { name = "beautifulsoup4", specifier = ">=4.12.3" }, { name = "granian", extras = ["reload"], specifier = ">=1.6.1" }, { name = "httpx", specifier = ">=0.27.2" },