CodeChef Stats API#
FastAPI REST API for scraping public CodeChef profile data.
The root route serves a lightweight HTML documentation page similar to the CodeForces API project,
/dashboard provides a handle-driven response viewer for all API endpoints, and Swagger/OpenAPI
remains available at /docs.
Structure#
core/shared configurationcore/cache.pyin-memory TTL response cachecore/rate_limit.pyin-memory request limitermodels/response modelsroutes/profile.pyprofile info routeroutes/heatmap.pyheatmap data routeroutes/rating.pyrating history routeservices/profile.pyprofile scraping and normalizationservices/heatmap.pyheatmap data serviceservices/rating.pyrating history servicemain.pyFastAPI entrypoint
Run#
uv sync
uv run uvicorn main:app --reload
Run tests:
uv run pytest
Endpoint#
GET /profile/{handle}
GET /
GET /heatmap/{handle}
Heatmap query options:
GET /heatmap/{handle}?view=last_365
GET /heatmap/{handle}?view=year&year=2025
GET /heatmap/{handle}?view=all
GET /rating/{handle}
GET /dashboard
Behavior#
- upstream CodeChef fetches are cached in memory
- API routes are rate-limited per client IP