An API written with the FastAPI
framework that provides the NSW Covid Stats found on NSW COVID 19 Stats Page - Active Cases, Reported Cases, and Vaccine Numbers.
The numbers on the page are webscraped using BeautifulSoup4
and saved to a Redis
database. This allows the API to maintain performance and decouples the updating of information with the API.
Currently you can interact with the API @ dcong.page/covid-stats
(HTTPS)
- Ensure you have a running redis database on your system on port
6379
- Clone this repo
git clone https://github.com/kingkonggrunt/nsw_covid19_stats.git
- Enter the directory
cd nsw_covid19_stats
- Create and activate a venv
python3 -m venv venv
. venv/bin/activate
- Install packages
pip3 install -r requirements.txt
- Launch the API using
uvicorn api:app --reload
on your localhost in devmode. Useuvicorn api:app --host 0.0.0.0 --port 3400
to launch the API exposed to the internet - accessible by your IP address. - Launch the updater using
python3 updater.py
. The updater just updates values every 3 hours.
- HTTPS
- Custom Domain Name
- Updater Tweaks
Author: Duc Cong Duong