From e0c85f35230ad952fc2acce0cbb5c5fbf8560556 Mon Sep 17 00:00:00 2001 From: austnv Date: Sun, 14 Jun 2026 22:43:37 +0300 Subject: [PATCH] add /api/v1/tariffs endpoint --- pyproject.toml | 1 + routers/tariffs.py | 9 +++++++++ uv.lock | 11 +++++++++++ 3 files changed, 21 insertions(+) create mode 100644 routers/tariffs.py diff --git a/pyproject.toml b/pyproject.toml index 549ec46..06013b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,6 +5,7 @@ description = "Add your description here" readme = "README.md" requires-python = ">=3.12" dependencies = [ + "aiofiles>=25.1.0", "bs4>=0.0.2", "fastapi>=0.136.3", "httpx>=0.28.1", diff --git a/routers/tariffs.py b/routers/tariffs.py new file mode 100644 index 0000000..a4e7f77 --- /dev/null +++ b/routers/tariffs.py @@ -0,0 +1,9 @@ +from fastapi import APIRouter, Request +import aiofiles + +router = APIRouter(prefix='/api/v1', tags=['tariffs']) + +@router.get('/tariffs') +async def get_tariffs(request: Request): + async with aiofiles.open('/opt/remnawave-minishop/data/tariffs.json', 'r', encoding='utf-8') as file: + return await file.read() \ No newline at end of file diff --git a/uv.lock b/uv.lock index 10ba332..ea0b499 100644 --- a/uv.lock +++ b/uv.lock @@ -7,6 +7,15 @@ resolution-markers = [ "python_full_version < '3.13'", ] +[[package]] +name = "aiofiles" +version = "25.1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/41/c3/534eac40372d8ee36ef40df62ec129bee4fdb5ad9706e58a29be53b2c970/aiofiles-25.1.0.tar.gz", hash = "sha256:a8d728f0a29de45dc521f18f07297428d56992a742f0cd2701ba86e44d23d5b2", size = 46354, upload-time = "2025-10-09T20:51:04.358Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/bc/8a/340a1555ae33d7354dbca4faa54948d76d89a27ceef032c8c3bc661d003e/aiofiles-25.1.0-py3-none-any.whl", hash = "sha256:abe311e527c862958650f9438e859c1fa7568a141b22abcd015e120e86a85695", size = 14668, upload-time = "2025-10-09T20:51:03.174Z" }, +] + [[package]] name = "annotated-doc" version = "0.0.4" @@ -883,6 +892,7 @@ name = "uvpn-backend" version = "0.1.0" source = { virtual = "." } dependencies = [ + { name = "aiofiles" }, { name = "bs4" }, { name = "fastapi" }, { name = "httpx" }, @@ -896,6 +906,7 @@ dev = [ [package.metadata] requires-dist = [ + { name = "aiofiles", specifier = ">=25.1.0" }, { name = "bs4", specifier = ">=0.0.2" }, { name = "fastapi", specifier = ">=0.136.3" }, { name = "httpx", specifier = ">=0.28.1" },