Open Weather Application is a Flask-based service that fetches weather data from the OpenWeatherMap API based on a list of city IDs.
Before you begin, ensure you have the following installed:
- Python 3.x
- Docker (If you're using the Dockerized version of the application)
- Flask: Flask is a lightweight web framework in Python. It provides tools, libraries, and technologies that allow you to build a web application. In this project, Flask serves as the foundation for setting up routes, handling HTTP requests, and rendering responses.
- OpenWeatherMap API Key
Clone the repository to your local machine:
git clone https://github.com/guilhermecarvalho18/Open_Weather_Application.git
cd Open_Weather_Application
Install the required Python packages:
pip install -r requirements.txt
Set the OpenWeatherMap API key:
export OPEN_WEATHER_API_KEY=your_api_key_here
Navigate to the project root and start the Flask server:
python src/app.py
Build the Docker image:
docker build -t open-weather-service:latest .
Run the container:
docker run -p 8000:8000 open-weather-service:latest
Access the service at http://localhost:8000/.
Navigate to the project root and execute:
pytest tests/
For detailed test scenarios and expected outcomes, refer to the tests/ directory.
- URL: /weather
- Method: POST
- Body Params:
{ "user_id": "<unique_user_id>" }
- Success Response:
- Code: 201
- Content:
{ "message": "Data collected successfully!" }
- URL: /weather/<user_id>
- Method: GET
- Success Response:
- Code: 200
- Content:
{ "progress": <percentage> }
For further details and potential API enhancements, refer to the respective modules and service layers.