Requires Python3 v3.5+ to run.
Install Pyenv packaging tool.
pip install --user pipenv
Read the following the instructions to install Redis according your OS. https://redis.io/docs/getting-started/installation/
Clone the repository:
git clone https://github.com/alfredo138923/weather_api.git
cd weather_api
Install the dependencies using pipenv:
pipenv sync
Activate the enviroment:
pipenv shell
Create a .secrets.toml file in the root directory to store all the sensitive data with the following format to connect to openweathermap:
[default]
TOKEN = 'my-very-secret token'
OPENWEATHER_API_ENDPOINT = 'http://api.openweathermap.org/data/2.5/weather'
Run tests from root directory:
python -m pytest -s tests
Run the Flask server:
flask run
API call.
HTTP Method: GET
http://localhost:8050/get_current_weather/
Parameters:
parameter | type | required | description |
---|---|---|---|
country | string | true | Code of the country. Codes |
city | string | true | Name of the city |
units | string | false | Units of measurement: standard, metric (default: standard) |
GNU General Public License v3.0