start
This commit is contained in:
33
.gitignore
vendored
Normal file
33
.gitignore
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
.env
|
||||||
|
.venv
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
*.pyo
|
||||||
|
*.pyd
|
||||||
|
*.db
|
||||||
|
*.sqlite3
|
||||||
|
*.log
|
||||||
|
.DS_Store
|
||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
*.bak
|
||||||
|
*.tmp
|
||||||
|
*.egg-info/
|
||||||
|
dist/
|
||||||
|
build/
|
||||||
|
*.egg
|
||||||
|
*.egg-info/
|
||||||
|
*.log
|
||||||
|
*.cover
|
||||||
|
.coverage
|
||||||
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.nox/
|
||||||
|
.coverage.*
|
||||||
|
.cache/
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*.cover
|
||||||
|
*.mp3
|
||||||
1
.python-version
Normal file
1
.python-version
Normal file
@@ -0,0 +1 @@
|
|||||||
|
3.14
|
||||||
11
Dockerfile.api
Normal file
11
Dockerfile.api
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
FROM python:3.11-slim
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
COPY . ./api
|
||||||
|
|
||||||
|
CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||||
2
api/README.md
Normal file
2
api/README.md
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Для запуска API отдельно:
|
||||||
|
# uvicorn api.main:app --reload
|
||||||
28
api/config.py
Normal file
28
api/config.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
from pydantic_settings import BaseSettings
|
||||||
|
import os
|
||||||
|
|
||||||
|
def _env(*names, default=None):
|
||||||
|
for n in names:
|
||||||
|
v = os.getenv(n)
|
||||||
|
if v:
|
||||||
|
return v
|
||||||
|
return default
|
||||||
|
|
||||||
|
class Settings(BaseSettings):
|
||||||
|
# support both custom DB_* names and common POSTGRES_* names from postgres images
|
||||||
|
DB_USER: str = _env("DB_USER", "POSTGRES_USER", default="postgres")
|
||||||
|
DB_PASS: str = _env("DB_PASS", "POSTGRES_PASSWORD", default="postgres")
|
||||||
|
DB_NAME: str = _env("DB_NAME", "POSTGRES_DB", default="vpn_bot_db")
|
||||||
|
DB_HOST: str = _env("DB_HOST", "POSTGRES_HOST", "DB_HOST", default="db")
|
||||||
|
DB_PORT: str = _env("DB_PORT", "POSTGRES_PORT", default="5432")
|
||||||
|
|
||||||
|
# If explicit DB_* variables are provided, build DATABASE_URL from them (priority).
|
||||||
|
# Otherwise fall back to explicit DATABASE_URL or DATABASE_URL_ASYNC env.
|
||||||
|
_built_db_url: str | None = None
|
||||||
|
if DB_USER and DB_PASS and DB_NAME and DB_HOST and DB_PORT:
|
||||||
|
_built_db_url = f"postgresql+asyncpg://{DB_USER}:{DB_PASS}@{DB_HOST}:{DB_PORT}/{DB_NAME}"
|
||||||
|
|
||||||
|
DATABASE_URL: str = _built_db_url or _env("DATABASE_URL", "DATABASE_URL_ASYNC", default="")
|
||||||
|
|
||||||
|
|
||||||
|
settings = Settings()
|
||||||
27
api/db/connection.py
Normal file
27
api/db/connection.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
|
||||||
|
from sqlalchemy.orm import sessionmaker
|
||||||
|
from sqlalchemy import text
|
||||||
|
import asyncio
|
||||||
|
from api.config import settings
|
||||||
|
|
||||||
|
DATABASE_URL = settings.DATABASE_URL
|
||||||
|
engine = create_async_engine(DATABASE_URL, echo=False, future=True)
|
||||||
|
SessionLocal = sessionmaker(engine, expire_on_commit=False, class_=AsyncSession)
|
||||||
|
|
||||||
|
|
||||||
|
async def wait_for_db(retries: int = 12, delay: float = 1.0) -> None:
|
||||||
|
"""Wait until the database is available. Retries with exponential backoff.
|
||||||
|
|
||||||
|
Raises RuntimeError if DB is still unavailable after retries.
|
||||||
|
"""
|
||||||
|
last_exc = None
|
||||||
|
for attempt in range(1, retries + 1):
|
||||||
|
try:
|
||||||
|
async with engine.connect() as conn:
|
||||||
|
await conn.execute(text("SELECT 1"))
|
||||||
|
return
|
||||||
|
except Exception as e:
|
||||||
|
last_exc = e
|
||||||
|
wait = min(delay * (2 ** (attempt - 1)), 5)
|
||||||
|
await asyncio.sleep(wait)
|
||||||
|
raise RuntimeError(f"Could not connect to DB after {retries} attempts") from last_exc
|
||||||
121
api/db/subscription.py
Normal file
121
api/db/subscription.py
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
from api.db.connection import engine, SessionLocal
|
||||||
|
from api.models.subscription import Subscription
|
||||||
|
from api.models.base import Base
|
||||||
|
from api.config import settings
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
from sqlalchemy import select
|
||||||
|
import asyncpg
|
||||||
|
|
||||||
|
|
||||||
|
async def init_db():
|
||||||
|
try:
|
||||||
|
async with engine.begin() as conn:
|
||||||
|
await conn.run_sync(Base.metadata.create_all)
|
||||||
|
return
|
||||||
|
except Exception as exc: # try to create database if it doesn't exist
|
||||||
|
msg = str(exc).lower()
|
||||||
|
if "does not exist" in msg or "invalidcatalogname" in msg or "database" in msg:
|
||||||
|
try:
|
||||||
|
admin_conn = await asyncpg.connect(
|
||||||
|
user=settings.DB_USER,
|
||||||
|
password=settings.DB_PASS,
|
||||||
|
database="postgres",
|
||||||
|
host=settings.DB_HOST,
|
||||||
|
port=int(settings.DB_PORT),
|
||||||
|
)
|
||||||
|
try:
|
||||||
|
await admin_conn.execute(f'CREATE DATABASE "{settings.DB_NAME}"')
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
await admin_conn.close()
|
||||||
|
except Exception:
|
||||||
|
raise
|
||||||
|
async with engine.begin() as conn:
|
||||||
|
await conn.run_sync(Base.metadata.create_all)
|
||||||
|
return
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
async def create_subscription(user_id: str, uuid: str, until: datetime, subscription_link: str | None = None, connect_link: str | None = None, active: bool = True):
|
||||||
|
async with SessionLocal() as session:
|
||||||
|
# if user already has a subscription, remove it (replace)
|
||||||
|
q = select(Subscription).where(Subscription.user_id == user_id)
|
||||||
|
res = await session.execute(q)
|
||||||
|
existing = res.scalars().first()
|
||||||
|
if existing:
|
||||||
|
await session.delete(existing)
|
||||||
|
# avoid NULL in DB: replace None links with empty strings
|
||||||
|
safe_subscription_link = subscription_link if subscription_link is not None else ""
|
||||||
|
safe_connect_link = connect_link if connect_link is not None else ""
|
||||||
|
sub = Subscription(user_id=user_id, uuid=uuid, until=until, active=active, subscription_link=safe_subscription_link, connect_link=safe_connect_link)
|
||||||
|
session.add(sub)
|
||||||
|
await session.commit()
|
||||||
|
await session.refresh(sub)
|
||||||
|
return sub
|
||||||
|
|
||||||
|
|
||||||
|
async def get_subscription_by_user(user_id: str):
|
||||||
|
async with SessionLocal() as session:
|
||||||
|
q = select(Subscription).where(Subscription.user_id == user_id)
|
||||||
|
res = await session.execute(q)
|
||||||
|
sub = res.scalars().first()
|
||||||
|
return sub
|
||||||
|
|
||||||
|
|
||||||
|
async def get_subscription_by_uuid(sub_uuid: str):
|
||||||
|
async with SessionLocal() as session:
|
||||||
|
q = select(Subscription).where(Subscription.uuid == sub_uuid)
|
||||||
|
res = await session.execute(q)
|
||||||
|
return res.scalars().first()
|
||||||
|
|
||||||
|
|
||||||
|
async def update_subscription(sub_uuid: str, until: datetime = None, user_id: str | None = None, active: bool | None = None, subscription_link: str | None = None, connect_link: str | None = None):
|
||||||
|
async with SessionLocal() as session:
|
||||||
|
q = select(Subscription).where(Subscription.uuid == sub_uuid)
|
||||||
|
res = await session.execute(q)
|
||||||
|
sub = res.scalars().first()
|
||||||
|
if not sub:
|
||||||
|
return None
|
||||||
|
if until is not None:
|
||||||
|
sub.until = until
|
||||||
|
if user_id is not None:
|
||||||
|
sub.user_id = user_id
|
||||||
|
if active is not None:
|
||||||
|
sub.active = active
|
||||||
|
if subscription_link is not None:
|
||||||
|
sub.subscription_link = subscription_link
|
||||||
|
if connect_link is not None:
|
||||||
|
sub.connect_link = connect_link
|
||||||
|
await session.commit()
|
||||||
|
return sub
|
||||||
|
|
||||||
|
|
||||||
|
async def delete_subscription(sub_uuid: str):
|
||||||
|
async with SessionLocal() as session:
|
||||||
|
q = select(Subscription).where(Subscription.uuid == sub_uuid)
|
||||||
|
res = await session.execute(q)
|
||||||
|
sub = res.scalars().first()
|
||||||
|
if not sub:
|
||||||
|
return False
|
||||||
|
await session.delete(sub)
|
||||||
|
await session.commit()
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
async def list_subscriptions():
|
||||||
|
async with SessionLocal() as session:
|
||||||
|
q = select(Subscription)
|
||||||
|
res = await session.execute(q)
|
||||||
|
return res.scalars().all()
|
||||||
|
|
||||||
|
|
||||||
|
async def extend_subscription_by_user(user_id: str, months: int):
|
||||||
|
sub = await get_subscription_by_user(user_id)
|
||||||
|
if sub:
|
||||||
|
new_until = max(sub.until, datetime.now()) + timedelta(days=30 * months)
|
||||||
|
return await update_subscription(sub.uuid, until=new_until, active=True)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
async def deactivate_subscription(sub_uuid: str):
|
||||||
|
return await update_subscription(sub_uuid, active=False)
|
||||||
64
api/db/user.py
Normal file
64
api/db/user.py
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
from api.db.connection import SessionLocal
|
||||||
|
from api.models.user import User
|
||||||
|
from sqlalchemy import select
|
||||||
|
|
||||||
|
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
|
||||||
|
async def create_user(telegram_id: str, name: str | None = None):
|
||||||
|
async with SessionLocal() as session:
|
||||||
|
# ensure no NULL in DB: replace None with empty string
|
||||||
|
safe_name = name if name is not None else ""
|
||||||
|
user = User(id=str(uuid.uuid4()), telegram_id=telegram_id, name=safe_name)
|
||||||
|
session.add(user)
|
||||||
|
await session.commit()
|
||||||
|
await session.refresh(user)
|
||||||
|
return user
|
||||||
|
|
||||||
|
|
||||||
|
async def get_user(user_id: str):
|
||||||
|
async with SessionLocal() as session:
|
||||||
|
q = select(User).where(User.id == user_id)
|
||||||
|
res = await session.execute(q)
|
||||||
|
return res.scalars().first()
|
||||||
|
|
||||||
|
|
||||||
|
async def get_user_by_telegram(telegram_id: str):
|
||||||
|
async with SessionLocal() as session:
|
||||||
|
q = select(User).where(User.telegram_id == telegram_id)
|
||||||
|
res = await session.execute(q)
|
||||||
|
return res.scalars().first()
|
||||||
|
|
||||||
|
|
||||||
|
async def update_user(user_id: str, name: str | None = None):
|
||||||
|
async with SessionLocal() as session:
|
||||||
|
q = select(User).where(User.id == user_id)
|
||||||
|
res = await session.execute(q)
|
||||||
|
user = res.scalars().first()
|
||||||
|
if not user:
|
||||||
|
return None
|
||||||
|
if name is not None:
|
||||||
|
# replace None handled by caller; here update only when provided
|
||||||
|
user.name = name
|
||||||
|
await session.commit()
|
||||||
|
return user
|
||||||
|
|
||||||
|
|
||||||
|
async def delete_user(user_id: str):
|
||||||
|
async with SessionLocal() as session:
|
||||||
|
q = select(User).where(User.id == user_id)
|
||||||
|
res = await session.execute(q)
|
||||||
|
user = res.scalars().first()
|
||||||
|
if not user:
|
||||||
|
return False
|
||||||
|
await session.delete(user)
|
||||||
|
await session.commit()
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
async def list_users():
|
||||||
|
async with SessionLocal() as session:
|
||||||
|
q = select(User)
|
||||||
|
res = await session.execute(q)
|
||||||
|
return res.scalars().all()
|
||||||
17
api/main.py
Normal file
17
api/main.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import asyncio
|
||||||
|
from fastapi import FastAPI
|
||||||
|
from api.route import default, subscription
|
||||||
|
from api.route import users
|
||||||
|
from api.db.subscription import init_db
|
||||||
|
from api.db.connection import wait_for_db
|
||||||
|
|
||||||
|
app = FastAPI(title="VPN Bot API")
|
||||||
|
|
||||||
|
@app.on_event("startup")
|
||||||
|
async def on_startup():
|
||||||
|
await wait_for_db()
|
||||||
|
await init_db()
|
||||||
|
|
||||||
|
app.include_router(default.router)
|
||||||
|
app.include_router(subscription.router)
|
||||||
|
app.include_router(users.router)
|
||||||
3
api/models/base.py
Normal file
3
api/models/base.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from sqlalchemy.orm import declarative_base
|
||||||
|
|
||||||
|
Base = declarative_base()
|
||||||
14
api/models/subscription.py
Normal file
14
api/models/subscription.py
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
from sqlalchemy import Column, String, DateTime, ForeignKey, Boolean, Text
|
||||||
|
from api.models.base import Base
|
||||||
|
|
||||||
|
|
||||||
|
class Subscription(Base):
|
||||||
|
__tablename__ = 'subscriptions'
|
||||||
|
uuid = Column(String, primary_key=True, index=True)
|
||||||
|
# one subscription per user (unique)
|
||||||
|
user_id = Column(String, ForeignKey('users.id'), nullable=False, index=True, unique=True)
|
||||||
|
until = Column(DateTime, nullable=False)
|
||||||
|
active = Column(Boolean, nullable=False, default=True)
|
||||||
|
# avoid NULL: store empty string when no link provided
|
||||||
|
subscription_link = Column(Text, nullable=False, default="")
|
||||||
|
connect_link = Column(Text, nullable=False, default="")
|
||||||
12
api/models/user.py
Normal file
12
api/models/user.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
from sqlalchemy import Column, String, DateTime
|
||||||
|
from sqlalchemy.sql import func
|
||||||
|
from api.models.base import Base
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
|
||||||
|
class User(Base):
|
||||||
|
__tablename__ = 'users'
|
||||||
|
id = Column(String, primary_key=True, default=lambda: str(uuid.uuid4()))
|
||||||
|
telegram_id = Column(String, unique=True, index=True, nullable=False)
|
||||||
|
name = Column(String, nullable=False, default="")
|
||||||
|
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||||
17
api/route/default.py
Normal file
17
api/route/default.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
from fastapi import APIRouter
|
||||||
|
import toml
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
@router.get("/")
|
||||||
|
async def root():
|
||||||
|
version = "dev"
|
||||||
|
pyproject_path = Path(__file__).parent.parent.parent / "pyproject.toml"
|
||||||
|
if pyproject_path.exists():
|
||||||
|
try:
|
||||||
|
data = toml.load(pyproject_path)
|
||||||
|
version = data.get("project", {}).get("version", "dev")
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return {"status": "ok", "msg": "VPN Bot API", "version": version}
|
||||||
94
api/route/subscription.py
Normal file
94
api/route/subscription.py
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
from fastapi import APIRouter, HTTPException
|
||||||
|
from pydantic import BaseModel
|
||||||
|
from typing import Optional, List
|
||||||
|
from api.db.subscription import (
|
||||||
|
create_subscription,
|
||||||
|
get_subscription_by_user,
|
||||||
|
get_subscription_by_uuid,
|
||||||
|
update_subscription,
|
||||||
|
delete_subscription,
|
||||||
|
list_subscriptions,
|
||||||
|
extend_subscription_by_user,
|
||||||
|
)
|
||||||
|
import uuid
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
router = APIRouter(prefix="/subscription", tags=["subscription"])
|
||||||
|
|
||||||
|
|
||||||
|
class SubscriptionInfo(BaseModel):
|
||||||
|
user_id: str
|
||||||
|
uuid: str
|
||||||
|
until: datetime
|
||||||
|
active: bool
|
||||||
|
subscription_link: Optional[str] = None
|
||||||
|
connect_link: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
|
class SubscriptionCreate(BaseModel):
|
||||||
|
user_id: str
|
||||||
|
months: int
|
||||||
|
subscription_link: Optional[str] = None
|
||||||
|
connect_link: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
|
class SubscriptionUpdate(BaseModel):
|
||||||
|
until: Optional[datetime]
|
||||||
|
user_id: Optional[str]
|
||||||
|
active: Optional[bool] = None
|
||||||
|
subscription_link: Optional[str] = None
|
||||||
|
connect_link: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/{user_id}", response_model=Optional[SubscriptionInfo])
|
||||||
|
async def get_user_subscription(user_id: str):
|
||||||
|
sub = await get_subscription_by_user(user_id)
|
||||||
|
if not sub:
|
||||||
|
return None
|
||||||
|
return SubscriptionInfo(user_id=sub.user_id, uuid=sub.uuid, until=sub.until)
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/new", response_model=SubscriptionInfo)
|
||||||
|
async def create_subscription_endpoint(data: SubscriptionCreate):
|
||||||
|
sub_id = str(uuid.uuid4())
|
||||||
|
until = datetime.now() + timedelta(days=30 * data.months)
|
||||||
|
sub = await create_subscription(data.user_id, sub_id, until, subscription_link=data.subscription_link, connect_link=data.connect_link, active=True)
|
||||||
|
return SubscriptionInfo(user_id=sub.user_id, uuid=sub.uuid, until=sub.until)
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/extend", response_model=SubscriptionInfo)
|
||||||
|
async def extend_user_subscription(data: SubscriptionCreate):
|
||||||
|
sub = await extend_subscription_by_user(data.user_id, data.months)
|
||||||
|
if not sub:
|
||||||
|
raise HTTPException(status_code=404, detail="Subscription not found")
|
||||||
|
return SubscriptionInfo(user_id=sub.user_id, uuid=sub.uuid, until=sub.until, active=sub.active, subscription_link=sub.subscription_link, connect_link=sub.connect_link)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/by-uuid/{sub_uuid}", response_model=Optional[SubscriptionInfo])
|
||||||
|
async def get_subscription_uuid(sub_uuid: str):
|
||||||
|
sub = await get_subscription_by_uuid(sub_uuid)
|
||||||
|
if not sub:
|
||||||
|
raise HTTPException(status_code=404, detail="Subscription not found")
|
||||||
|
return SubscriptionInfo(user_id=sub.user_id, uuid=sub.uuid, until=sub.until, active=sub.active, subscription_link=sub.subscription_link, connect_link=sub.connect_link)
|
||||||
|
|
||||||
|
|
||||||
|
@router.patch("/{sub_uuid}", response_model=SubscriptionInfo)
|
||||||
|
async def update_subscription_endpoint(sub_uuid: str, data: SubscriptionUpdate):
|
||||||
|
sub = await update_subscription(sub_uuid, until=data.until, user_id=data.user_id, active=data.active, subscription_link=data.subscription_link, connect_link=data.connect_link)
|
||||||
|
if not sub:
|
||||||
|
raise HTTPException(status_code=404, detail="Subscription not found")
|
||||||
|
return SubscriptionInfo(user_id=sub.user_id, uuid=sub.uuid, until=sub.until, active=sub.active, subscription_link=sub.subscription_link, connect_link=sub.connect_link)
|
||||||
|
|
||||||
|
|
||||||
|
@router.delete("/{sub_uuid}")
|
||||||
|
async def delete_subscription_endpoint(sub_uuid: str):
|
||||||
|
ok = await delete_subscription(sub_uuid)
|
||||||
|
if not ok:
|
||||||
|
raise HTTPException(status_code=404, detail="Subscription not found")
|
||||||
|
return {"ok": True}
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/", response_model=List[SubscriptionInfo])
|
||||||
|
async def list_all_subscriptions():
|
||||||
|
subs = await list_subscriptions()
|
||||||
|
return [SubscriptionInfo(user_id=s.user_id, uuid=s.uuid, until=s.until) for s in subs]
|
||||||
107
api/route/users.py
Normal file
107
api/route/users.py
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
from fastapi import APIRouter, HTTPException
|
||||||
|
from pydantic import BaseModel
|
||||||
|
from typing import Optional, List
|
||||||
|
from api.db.user import create_user, get_user, get_user_by_telegram, update_user, delete_user, list_users
|
||||||
|
from api.db.subscription import (
|
||||||
|
create_subscription,
|
||||||
|
get_subscription_by_user,
|
||||||
|
update_subscription,
|
||||||
|
delete_subscription,
|
||||||
|
)
|
||||||
|
from api.route.subscription import SubscriptionInfo
|
||||||
|
|
||||||
|
router = APIRouter(prefix="/users", tags=["users"])
|
||||||
|
|
||||||
|
|
||||||
|
class UserOut(BaseModel):
|
||||||
|
id: str
|
||||||
|
telegram_id: str
|
||||||
|
name: Optional[str]
|
||||||
|
subscription: Optional[SubscriptionInfo] = None
|
||||||
|
|
||||||
|
|
||||||
|
class UserCreate(BaseModel):
|
||||||
|
telegram_id: str
|
||||||
|
name: Optional[str]
|
||||||
|
|
||||||
|
|
||||||
|
class UserUpdate(BaseModel):
|
||||||
|
name: Optional[str]
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/", response_model=UserOut)
|
||||||
|
async def api_create_user(data: UserCreate):
|
||||||
|
existing = await get_user_by_telegram(data.telegram_id)
|
||||||
|
if existing:
|
||||||
|
raise HTTPException(status_code=400, detail="User already exists")
|
||||||
|
u = await create_user(data.telegram_id, data.name)
|
||||||
|
return UserOut(id=u.id, telegram_id=u.telegram_id, name=u.name)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/{user_id}", response_model=UserOut)
|
||||||
|
async def api_get_user(user_id: str, expand: Optional[str] = None):
|
||||||
|
u = await get_user(user_id)
|
||||||
|
if not u:
|
||||||
|
raise HTTPException(status_code=404, detail="User not found")
|
||||||
|
out = UserOut(id=u.id, telegram_id=u.telegram_id, name=u.name)
|
||||||
|
if expand == "subscription":
|
||||||
|
sub = await get_subscription_by_user(u.id)
|
||||||
|
if sub:
|
||||||
|
out.subscription = SubscriptionInfo(user_id=sub.user_id, uuid=sub.uuid, until=sub.until, active=sub.active, subscription_link=sub.subscription_link, connect_link=sub.connect_link)
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/{user_id}/subscription", response_model=SubscriptionInfo)
|
||||||
|
async def api_create_user_subscription(user_id: str, data: dict):
|
||||||
|
# expected keys: months, subscription_link (opt), connect_link (opt)
|
||||||
|
months = int(data.get("months", 1))
|
||||||
|
subscription_link = data.get("subscription_link")
|
||||||
|
connect_link = data.get("connect_link")
|
||||||
|
import uuid as _uuid
|
||||||
|
sub_id = str(_uuid.uuid4())
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
until = datetime.now() + timedelta(days=30 * months)
|
||||||
|
sub = await create_subscription(user_id, sub_id, until, subscription_link=subscription_link, connect_link=connect_link, active=True)
|
||||||
|
return SubscriptionInfo(user_id=sub.user_id, uuid=sub.uuid, until=sub.until, active=sub.active, subscription_link=sub.subscription_link, connect_link=sub.connect_link)
|
||||||
|
|
||||||
|
|
||||||
|
@router.patch("/{user_id}/subscription", response_model=SubscriptionInfo)
|
||||||
|
async def api_update_user_subscription(user_id: str, data: dict):
|
||||||
|
sub = await get_subscription_by_user(user_id)
|
||||||
|
if not sub:
|
||||||
|
raise HTTPException(status_code=404, detail="Subscription not found for user")
|
||||||
|
updated = await update_subscription(sub.uuid, until=data.get("until"), user_id=data.get("user_id"), active=data.get("active"), subscription_link=data.get("subscription_link"), connect_link=data.get("connect_link"))
|
||||||
|
return SubscriptionInfo(user_id=updated.user_id, uuid=updated.uuid, until=updated.until, active=updated.active, subscription_link=updated.subscription_link, connect_link=updated.connect_link)
|
||||||
|
|
||||||
|
|
||||||
|
@router.delete("/{user_id}/subscription")
|
||||||
|
async def api_delete_user_subscription(user_id: str):
|
||||||
|
sub = await get_subscription_by_user(user_id)
|
||||||
|
if not sub:
|
||||||
|
raise HTTPException(status_code=404, detail="Subscription not found for user")
|
||||||
|
ok = await delete_subscription(sub.uuid)
|
||||||
|
if not ok:
|
||||||
|
raise HTTPException(status_code=500, detail="Failed to delete subscription")
|
||||||
|
return {"ok": True}
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/", response_model=List[UserOut])
|
||||||
|
async def api_list_users():
|
||||||
|
users = await list_users()
|
||||||
|
return [UserOut(id=u.id, telegram_id=u.telegram_id, name=u.name) for u in users]
|
||||||
|
|
||||||
|
|
||||||
|
@router.patch("/{user_id}", response_model=UserOut)
|
||||||
|
async def api_update_user(user_id: str, data: UserUpdate):
|
||||||
|
u = await update_user(user_id, name=data.name)
|
||||||
|
if not u:
|
||||||
|
raise HTTPException(status_code=404, detail="User not found")
|
||||||
|
return UserOut(id=u.id, telegram_id=u.telegram_id, name=u.name)
|
||||||
|
|
||||||
|
|
||||||
|
@router.delete("/{user_id}")
|
||||||
|
async def api_delete_user(user_id: str):
|
||||||
|
ok = await delete_user(user_id)
|
||||||
|
if not ok:
|
||||||
|
raise HTTPException(status_code=404, detail="User not found")
|
||||||
|
return {"ok": True}
|
||||||
49
docker-compose.yml
Normal file
49
docker-compose.yml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
|
||||||
|
services:
|
||||||
|
#bot:
|
||||||
|
# build:
|
||||||
|
# context: .
|
||||||
|
# dockerfile: Dockerfile.bot
|
||||||
|
# container_name: telegram_bot
|
||||||
|
# restart: no
|
||||||
|
# env_file:
|
||||||
|
# - .env
|
||||||
|
# environment:
|
||||||
|
# - BOT_TOKEN=${BOT_TOKEN}
|
||||||
|
# command: python -m bot.main
|
||||||
|
# depends_on:
|
||||||
|
# - db
|
||||||
|
# volumes:
|
||||||
|
# - .:/app
|
||||||
|
|
||||||
|
api:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile.api
|
||||||
|
container_name: vpn_api
|
||||||
|
restart: no
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
command: uvicorn api.main:app --host 0.0.0.0 --port 8000
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: postgres:15-alpine
|
||||||
|
container_name: bot_db
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: ${DB_USER}
|
||||||
|
POSTGRES_PASSWORD: ${DB_PASS}
|
||||||
|
POSTGRES_DB: ${DB_NAME}
|
||||||
|
volumes:
|
||||||
|
- ./pg_data:/var/lib/postgresql/data
|
||||||
|
ports:
|
||||||
|
- "5433:5432"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
pg_data:
|
||||||
10
pyproject.toml
Normal file
10
pyproject.toml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[project]
|
||||||
|
name = "llm-infa"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Add your description here"
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">=3.14"
|
||||||
|
dependencies = [
|
||||||
|
"fastapi>=0.129.0",
|
||||||
|
"uvicorn>=0.41.0",
|
||||||
|
]
|
||||||
203
uv.lock
generated
Normal file
203
uv.lock
generated
Normal file
@@ -0,0 +1,203 @@
|
|||||||
|
version = 1
|
||||||
|
revision = 3
|
||||||
|
requires-python = ">=3.14"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "annotated-doc"
|
||||||
|
version = "0.0.4"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/57/ba/046ceea27344560984e26a590f90bc7f4a75b06701f653222458922b558c/annotated_doc-0.0.4.tar.gz", hash = "sha256:fbcda96e87e9c92ad167c2e53839e57503ecfda18804ea28102353485033faa4", size = 7288, upload-time = "2025-11-10T22:07:42.062Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/1e/d3/26bf1008eb3d2daa8ef4cacc7f3bfdc11818d111f7e2d0201bc6e3b49d45/annotated_doc-0.0.4-py3-none-any.whl", hash = "sha256:571ac1dc6991c450b25a9c2d84a3705e2ae7a53467b5d111c24fa8baabbed320", size = 5303, upload-time = "2025-11-10T22:07:40.673Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "annotated-types"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/ee/67/531ea369ba64dcff5ec9c3402f9f51bf748cec26dde048a2f973a4eea7f5/annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89", size = 16081, upload-time = "2024-05-20T21:33:25.928Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643, upload-time = "2024-05-20T21:33:24.1Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anyio"
|
||||||
|
version = "4.12.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "idna" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/96/f0/5eb65b2bb0d09ac6776f2eb54adee6abe8228ea05b20a5ad0e4945de8aac/anyio-4.12.1.tar.gz", hash = "sha256:41cfcc3a4c85d3f05c932da7c26d0201ac36f72abd4435ba90d0464a3ffed703", size = 228685, upload-time = "2026-01-06T11:45:21.246Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/38/0e/27be9fdef66e72d64c0cdc3cc2823101b80585f8119b5c112c2e8f5f7dab/anyio-4.12.1-py3-none-any.whl", hash = "sha256:d405828884fc140aa80a3c667b8beed277f1dfedec42ba031bd6ac3db606ab6c", size = 113592, upload-time = "2026-01-06T11:45:19.497Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "click"
|
||||||
|
version = "8.3.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/3d/fa/656b739db8587d7b5dfa22e22ed02566950fbfbcdc20311993483657a5c0/click-8.3.1.tar.gz", hash = "sha256:12ff4785d337a1bb490bb7e9c2b1ee5da3112e94a8622f26a6c77f5d2fc6842a", size = 295065, upload-time = "2025-11-15T20:45:42.706Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/98/78/01c019cdb5d6498122777c1a43056ebb3ebfeef2076d9d026bfe15583b2b/click-8.3.1-py3-none-any.whl", hash = "sha256:981153a64e25f12d547d3426c367a4857371575ee7ad18df2a6183ab0545b2a6", size = 108274, upload-time = "2025-11-15T20:45:41.139Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "colorama"
|
||||||
|
version = "0.4.6"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fastapi"
|
||||||
|
version = "0.129.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "annotated-doc" },
|
||||||
|
{ name = "pydantic" },
|
||||||
|
{ name = "starlette" },
|
||||||
|
{ name = "typing-extensions" },
|
||||||
|
{ name = "typing-inspection" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/48/47/75f6bea02e797abff1bca968d5997793898032d9923c1935ae2efdece642/fastapi-0.129.0.tar.gz", hash = "sha256:61315cebd2e65df5f97ec298c888f9de30430dd0612d59d6480beafbc10655af", size = 375450, upload-time = "2026-02-12T13:54:52.541Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/9e/dd/d0ee25348ac58245ee9f90b6f3cbb666bf01f69be7e0911f9851bddbda16/fastapi-0.129.0-py3-none-any.whl", hash = "sha256:b4946880e48f462692b31c083be0432275cbfb6e2274566b1be91479cc1a84ec", size = 102950, upload-time = "2026-02-12T13:54:54.528Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "h11"
|
||||||
|
version = "0.16.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/01/ee/02a2c011bdab74c6fb3c75474d40b3052059d95df7e73351460c8588d963/h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1", size = 101250, upload-time = "2025-04-24T03:35:25.427Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515, upload-time = "2025-04-24T03:35:24.344Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "idna"
|
||||||
|
version = "3.11"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/6f/6d/0703ccc57f3a7233505399edb88de3cbd678da106337b9fcde432b65ed60/idna-3.11.tar.gz", hash = "sha256:795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902", size = 194582, upload-time = "2025-10-12T14:55:20.501Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/0e/61/66938bbb5fc52dbdf84594873d5b51fb1f7c7794e9c0f5bd885f30bc507b/idna-3.11-py3-none-any.whl", hash = "sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea", size = 71008, upload-time = "2025-10-12T14:55:18.883Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "llm-infa"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = { virtual = "." }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "fastapi" },
|
||||||
|
{ name = "uvicorn" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.metadata]
|
||||||
|
requires-dist = [
|
||||||
|
{ name = "fastapi", specifier = ">=0.129.0" },
|
||||||
|
{ name = "uvicorn", specifier = ">=0.41.0" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pydantic"
|
||||||
|
version = "2.12.5"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "annotated-types" },
|
||||||
|
{ name = "pydantic-core" },
|
||||||
|
{ name = "typing-extensions" },
|
||||||
|
{ name = "typing-inspection" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/69/44/36f1a6e523abc58ae5f928898e4aca2e0ea509b5aa6f6f392a5d882be928/pydantic-2.12.5.tar.gz", hash = "sha256:4d351024c75c0f085a9febbb665ce8c0c6ec5d30e903bdb6394b7ede26aebb49", size = 821591, upload-time = "2025-11-26T15:11:46.471Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5a/87/b70ad306ebb6f9b585f114d0ac2137d792b48be34d732d60e597c2f8465a/pydantic-2.12.5-py3-none-any.whl", hash = "sha256:e561593fccf61e8a20fc46dfc2dfe075b8be7d0188df33f221ad1f0139180f9d", size = 463580, upload-time = "2025-11-26T15:11:44.605Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pydantic-core"
|
||||||
|
version = "2.41.5"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "typing-extensions" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/71/70/23b021c950c2addd24ec408e9ab05d59b035b39d97cdc1130e1bce647bb6/pydantic_core-2.41.5.tar.gz", hash = "sha256:08daa51ea16ad373ffd5e7606252cc32f07bc72b28284b6bc9c6df804816476e", size = 460952, upload-time = "2025-11-04T13:43:49.098Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ea/28/46b7c5c9635ae96ea0fbb779e271a38129df2550f763937659ee6c5dbc65/pydantic_core-2.41.5-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:3f37a19d7ebcdd20b96485056ba9e8b304e27d9904d233d7b1015db320e51f0a", size = 2119622, upload-time = "2025-11-04T13:40:56.68Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/74/1a/145646e5687e8d9a1e8d09acb278c8535ebe9e972e1f162ed338a622f193/pydantic_core-2.41.5-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:1d1d9764366c73f996edd17abb6d9d7649a7eb690006ab6adbda117717099b14", size = 1891725, upload-time = "2025-11-04T13:40:58.807Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/23/04/e89c29e267b8060b40dca97bfc64a19b2a3cf99018167ea1677d96368273/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:25e1c2af0fce638d5f1988b686f3b3ea8cd7de5f244ca147c777769e798a9cd1", size = 1915040, upload-time = "2025-11-04T13:41:00.853Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/84/a3/15a82ac7bd97992a82257f777b3583d3e84bdb06ba6858f745daa2ec8a85/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:506d766a8727beef16b7adaeb8ee6217c64fc813646b424d0804d67c16eddb66", size = 2063691, upload-time = "2025-11-04T13:41:03.504Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/74/9b/0046701313c6ef08c0c1cf0e028c67c770a4e1275ca73131563c5f2a310a/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4819fa52133c9aa3c387b3328f25c1facc356491e6135b459f1de698ff64d869", size = 2213897, upload-time = "2025-11-04T13:41:05.804Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/8a/cd/6bac76ecd1b27e75a95ca3a9a559c643b3afcd2dd62086d4b7a32a18b169/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2b761d210c9ea91feda40d25b4efe82a1707da2ef62901466a42492c028553a2", size = 2333302, upload-time = "2025-11-04T13:41:07.809Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/4c/d2/ef2074dc020dd6e109611a8be4449b98cd25e1b9b8a303c2f0fca2f2bcf7/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:22f0fb8c1c583a3b6f24df2470833b40207e907b90c928cc8d3594b76f874375", size = 2064877, upload-time = "2025-11-04T13:41:09.827Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/18/66/e9db17a9a763d72f03de903883c057b2592c09509ccfe468187f2a2eef29/pydantic_core-2.41.5-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2782c870e99878c634505236d81e5443092fba820f0373997ff75f90f68cd553", size = 2180680, upload-time = "2025-11-04T13:41:12.379Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d3/9e/3ce66cebb929f3ced22be85d4c2399b8e85b622db77dad36b73c5387f8f8/pydantic_core-2.41.5-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:0177272f88ab8312479336e1d777f6b124537d47f2123f89cb37e0accea97f90", size = 2138960, upload-time = "2025-11-04T13:41:14.627Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a6/62/205a998f4327d2079326b01abee48e502ea739d174f0a89295c481a2272e/pydantic_core-2.41.5-cp314-cp314-musllinux_1_1_armv7l.whl", hash = "sha256:63510af5e38f8955b8ee5687740d6ebf7c2a0886d15a6d65c32814613681bc07", size = 2339102, upload-time = "2025-11-04T13:41:16.868Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/3c/0d/f05e79471e889d74d3d88f5bd20d0ed189ad94c2423d81ff8d0000aab4ff/pydantic_core-2.41.5-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:e56ba91f47764cc14f1daacd723e3e82d1a89d783f0f5afe9c364b8bb491ccdb", size = 2326039, upload-time = "2025-11-04T13:41:18.934Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ec/e1/e08a6208bb100da7e0c4b288eed624a703f4d129bde2da475721a80cab32/pydantic_core-2.41.5-cp314-cp314-win32.whl", hash = "sha256:aec5cf2fd867b4ff45b9959f8b20ea3993fc93e63c7363fe6851424c8a7e7c23", size = 1995126, upload-time = "2025-11-04T13:41:21.418Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/48/5d/56ba7b24e9557f99c9237e29f5c09913c81eeb2f3217e40e922353668092/pydantic_core-2.41.5-cp314-cp314-win_amd64.whl", hash = "sha256:8e7c86f27c585ef37c35e56a96363ab8de4e549a95512445b85c96d3e2f7c1bf", size = 2015489, upload-time = "2025-11-04T13:41:24.076Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/4e/bb/f7a190991ec9e3e0ba22e4993d8755bbc4a32925c0b5b42775c03e8148f9/pydantic_core-2.41.5-cp314-cp314-win_arm64.whl", hash = "sha256:e672ba74fbc2dc8eea59fb6d4aed6845e6905fc2a8afe93175d94a83ba2a01a0", size = 1977288, upload-time = "2025-11-04T13:41:26.33Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/92/ed/77542d0c51538e32e15afe7899d79efce4b81eee631d99850edc2f5e9349/pydantic_core-2.41.5-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:8566def80554c3faa0e65ac30ab0932b9e3a5cd7f8323764303d468e5c37595a", size = 2120255, upload-time = "2025-11-04T13:41:28.569Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/bb/3d/6913dde84d5be21e284439676168b28d8bbba5600d838b9dca99de0fad71/pydantic_core-2.41.5-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:b80aa5095cd3109962a298ce14110ae16b8c1aece8b72f9dafe81cf597ad80b3", size = 1863760, upload-time = "2025-11-04T13:41:31.055Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5a/f0/e5e6b99d4191da102f2b0eb9687aaa7f5bea5d9964071a84effc3e40f997/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3006c3dd9ba34b0c094c544c6006cc79e87d8612999f1a5d43b769b89181f23c", size = 1878092, upload-time = "2025-11-04T13:41:33.21Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/71/48/36fb760642d568925953bcc8116455513d6e34c4beaa37544118c36aba6d/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:72f6c8b11857a856bcfa48c86f5368439f74453563f951e473514579d44aa612", size = 2053385, upload-time = "2025-11-04T13:41:35.508Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/20/25/92dc684dd8eb75a234bc1c764b4210cf2646479d54b47bf46061657292a8/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5cb1b2f9742240e4bb26b652a5aeb840aa4b417c7748b6f8387927bc6e45e40d", size = 2218832, upload-time = "2025-11-04T13:41:37.732Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/e2/09/f53e0b05023d3e30357d82eb35835d0f6340ca344720a4599cd663dca599/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:bd3d54f38609ff308209bd43acea66061494157703364ae40c951f83ba99a1a9", size = 2327585, upload-time = "2025-11-04T13:41:40Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/aa/4e/2ae1aa85d6af35a39b236b1b1641de73f5a6ac4d5a7509f77b814885760c/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2ff4321e56e879ee8d2a879501c8e469414d948f4aba74a2d4593184eb326660", size = 2041078, upload-time = "2025-11-04T13:41:42.323Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/cd/13/2e215f17f0ef326fc72afe94776edb77525142c693767fc347ed6288728d/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d0d2568a8c11bf8225044aa94409e21da0cb09dcdafe9ecd10250b2baad531a9", size = 2173914, upload-time = "2025-11-04T13:41:45.221Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/02/7a/f999a6dcbcd0e5660bc348a3991c8915ce6599f4f2c6ac22f01d7a10816c/pydantic_core-2.41.5-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:a39455728aabd58ceabb03c90e12f71fd30fa69615760a075b9fec596456ccc3", size = 2129560, upload-time = "2025-11-04T13:41:47.474Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/3a/b1/6c990ac65e3b4c079a4fb9f5b05f5b013afa0f4ed6780a3dd236d2cbdc64/pydantic_core-2.41.5-cp314-cp314t-musllinux_1_1_armv7l.whl", hash = "sha256:239edca560d05757817c13dc17c50766136d21f7cd0fac50295499ae24f90fdf", size = 2329244, upload-time = "2025-11-04T13:41:49.992Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d9/02/3c562f3a51afd4d88fff8dffb1771b30cfdfd79befd9883ee094f5b6c0d8/pydantic_core-2.41.5-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:2a5e06546e19f24c6a96a129142a75cee553cc018ffee48a460059b1185f4470", size = 2331955, upload-time = "2025-11-04T13:41:54.079Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5c/96/5fb7d8c3c17bc8c62fdb031c47d77a1af698f1d7a406b0f79aaa1338f9ad/pydantic_core-2.41.5-cp314-cp314t-win32.whl", hash = "sha256:b4ececa40ac28afa90871c2cc2b9ffd2ff0bf749380fbdf57d165fd23da353aa", size = 1988906, upload-time = "2025-11-04T13:41:56.606Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/22/ed/182129d83032702912c2e2d8bbe33c036f342cc735737064668585dac28f/pydantic_core-2.41.5-cp314-cp314t-win_amd64.whl", hash = "sha256:80aa89cad80b32a912a65332f64a4450ed00966111b6615ca6816153d3585a8c", size = 1981607, upload-time = "2025-11-04T13:41:58.889Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/9f/ed/068e41660b832bb0b1aa5b58011dea2a3fe0ba7861ff38c4d4904c1c1a99/pydantic_core-2.41.5-cp314-cp314t-win_arm64.whl", hash = "sha256:35b44f37a3199f771c3eaa53051bc8a70cd7b54f333531c59e29fd4db5d15008", size = 1974769, upload-time = "2025-11-04T13:42:01.186Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "starlette"
|
||||||
|
version = "0.52.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "anyio" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/c4/68/79977123bb7be889ad680d79a40f339082c1978b5cfcf62c2d8d196873ac/starlette-0.52.1.tar.gz", hash = "sha256:834edd1b0a23167694292e94f597773bc3f89f362be6effee198165a35d62933", size = 2653702, upload-time = "2026-01-18T13:34:11.062Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/81/0d/13d1d239a25cbfb19e740db83143e95c772a1fe10202dda4b76792b114dd/starlette-0.52.1-py3-none-any.whl", hash = "sha256:0029d43eb3d273bc4f83a08720b4912ea4b071087a3b48db01b7c839f7954d74", size = 74272, upload-time = "2026-01-18T13:34:09.188Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typing-extensions"
|
||||||
|
version = "4.15.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/72/94/1a15dd82efb362ac84269196e94cf00f187f7ed21c242792a923cdb1c61f/typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466", size = 109391, upload-time = "2025-08-25T13:49:26.313Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/18/67/36e9267722cc04a6b9f15c7f3441c2363321a3ea07da7ae0c0707beb2a9c/typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548", size = 44614, upload-time = "2025-08-25T13:49:24.86Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typing-inspection"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "typing-extensions" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/55/e3/70399cb7dd41c10ac53367ae42139cf4b1ca5f36bb3dc6c9d33acdb43655/typing_inspection-0.4.2.tar.gz", hash = "sha256:ba561c48a67c5958007083d386c3295464928b01faa735ab8547c5692e87f464", size = 75949, upload-time = "2025-10-01T02:14:41.687Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/dc/9b/47798a6c91d8bdb567fe2698fe81e0c6b7cb7ef4d13da4114b41d239f65d/typing_inspection-0.4.2-py3-none-any.whl", hash = "sha256:4ed1cacbdc298c220f1bd249ed5287caa16f34d44ef4e9c3d0cbad5b521545e7", size = 14611, upload-time = "2025-10-01T02:14:40.154Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "uvicorn"
|
||||||
|
version = "0.41.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "click" },
|
||||||
|
{ name = "h11" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/32/ce/eeb58ae4ac36fe09e3842eb02e0eb676bf2c53ae062b98f1b2531673efdd/uvicorn-0.41.0.tar.gz", hash = "sha256:09d11cf7008da33113824ee5a1c6422d89fbc2ff476540d69a34c87fab8b571a", size = 82633, upload-time = "2026-02-16T23:07:24.1Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/83/e4/d04a086285c20886c0daad0e026f250869201013d18f81d9ff5eada73a88/uvicorn-0.41.0-py3-none-any.whl", hash = "sha256:29e35b1d2c36a04b9e180d4007ede3bcb32a85fbdfd6c6aeb3f26839de088187", size = 68783, upload-time = "2026-02-16T23:07:22.357Z" },
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user