From de62b0943721a26364bf6fe245d1b59aa3306bd0 Mon Sep 17 00:00:00 2001 From: nex Date: Sat, 10 Feb 2024 01:57:03 +0000 Subject: [PATCH] Remove deprecated code thing --- server.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server.py b/server.py index a12cc14..c7fec00 100644 --- a/server.py +++ b/server.py @@ -1,3 +1,4 @@ +import contextlib import io import json import os @@ -124,7 +125,7 @@ CACHE_FILE = CACHE_DIR / "db.sqlite3" logging.debug("Cache file: %r", CACHE_FILE) -@app.on_event("startup") +@contextlib.asynccontextmanager async def startup(): if not CACHE_DIR.exists(): CACHE_DIR.mkdir(parents=True) @@ -139,6 +140,7 @@ async def startup(): ) """ ) + yield def upload_media(domain: str, access_token: str, file: io.BytesIO, filename: str, content_type: str): @@ -196,7 +198,7 @@ def preview_url( cursor = conn.cursor() cursor.execute( "SELECT metadata,ts FROM cache WHERE url = ?", - (url, ts) + (url,) ) results = cursor.fetchall() if results: