pinion - the smaller wheels turns the larger ...
A microservice which best serves applications that make uncommon and unpredictable requests for weather information
- Uses OpenWeatherMap API v2.5
- Keeps an in memory cache (memcached) of the response data
- Allows mixing of units as metric / imperial for speed and temperature
- Can be configured for a static location
now
- returns the weather nowhourly
- returns the weather for the next 48 hoursdaily
- returns the forecast for the next 8 daysalerts
- returns any alerts issued
Example: /?now&hourly
Passing no query params defaults to requesting all available data
The following parameters can be omitted, if the server config has been setup with defaults
speed
- can be eithermetric
orimperial
temp
- can be eithermetric
orimperial
nocache
- force pinion.weather to make a fresh request
Follow the example from config_example.ini
integer
(optional)number of minutes the cache is valid for, i.e, 60 for 1 hour
string
(optional)renew_daily - cache only valid for today
disable - disables all cache requests
- python >= 3.9.5
- pip
- pipenv or pythonenv
See the guide Installing memcached on Linux
See the guide Installing Python Dependencies on Linux
Make sure your
config.ini
is properly setup!
For production, it is recommended not to use pipenv
-
Create the virtual environment
python3 -m venv ./venv/
-
Activate the virtual environment
. venv/bin/activate
-
Install the requirements
pip install -r requirements.txt
-
Running the following script will setup pinion.weather as a systemd service on Linux
./register-service.sh
You can interact with the service with the following commands
systemctl start pinion.weather
systemctl stop pinion.weather
systemctl status pinion.weather
To test the server, run the following command within the virtual environment
pipenv run uvicorn app.main:app --host 0.0.0.0 --reload