1
Fork 0

Remove cache

For this use case, it's unnecessary
This commit is contained in:
Jake Howard 2024-10-22 21:54:29 +01:00
parent 9c98feba84
commit 62c2f929d6
Signed by: jake
GPG key ID: 57AFB45680EDD477
3 changed files with 3 additions and 19 deletions

10
main.py
View file

@ -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")

View file

@ -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",

11
uv.lock
View file

@ -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" },