A tiny FastAPI application that fetches live weather (via wttr.in) and exposes:
/weather?city=CityName— current weather/forecast?city=CityName— 3-day forecast
This repository contains everything needed to run locally or deploy to a host (Render, Vercel, Deta, etc.).
main.py— main FastAPI app (definesapp = FastAPI()).requirements.txt— Python dependencies.vercel.json— Optional config for Vercel deployments.README.md— this file.
-
Create & activate a virtualenv (optional but recommended):
python -m venv .venv # Windows .venv\Scripts\activate # macOS / Linux source .venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt -
Run with Uvicorn:
python -m uvicorn main:app --reload --host 0.0.0.0 --port 8000 -
Test:
http://127.0.0.1:8000/http://127.0.0.1:8000/weather?city=Londonhttp://127.0.0.1:8000/forecast?city=London