Virtualenv + run
python -m venv .venv
source .venv/bin/activate
python main.py
python -m venv .venv
source .venv/bin/activate
python main.py
from dataclasses import dataclass
@dataclass(frozen=True)
class User:
id: str
email: str
from typing import Any
async def fetch_json(url: str) -> dict[str, Any]:
import aiohttp
async with aiohttp.ClientSession() as s:
async with s.get(url) as r:
r.raise_for_status()
return await r.json()