API uses openweathermap.org open API to fetch weather data for city Warsaw and display it in json format.
Fetched data is stored in local SQLite database.
After server is started API fetches data automatically every 5 minutes.
- OpenWeatherMap API key - can be obtained after registering in https://openweathermap.org (free)
-
Clone repository
-
Create virtual environment with Python 3.9.7 using your favourite tool (venv, conda, etc...)
-
Activate virtual environment
-
Install dependencies
pip install -r requirements.txt
-
Create
.env
file in project root folder and fill in required variables
SECRET_KEY - can be copy-pasted from example below
WEATHERMAP_API_KEY - your openweathermap API key
DEBUG - True or FalseExample
SECRET_KEY=django-insecure-v_w%*rhD+=o43@ji2$%j)05-$@=to(i+g^ooiwf3@ow3m38f WEATHERMAP_API_KEY=<your_key> DEBUG=True
-
Initialize database
python src/manage.py migrate
-
Run server
python src/manage.py runserver
Notice: After server is started API fetches data automatically every 5 minutes. -
Have fun
Return list of data stored in local DB in json format
[GET] /data
Trigger data collection from openwathermap.org for city Warsaw and save it in local DB
[POST] /trigger
Interactive web interface (no resource URL, just host root)
[GET] /
documentation in json format
[GET] /swagger.json
documentation in yaml format
[GET] /swagger.yaml