A gRPC service that provides current weather data based on provided geocoordinates. This service fetches data from the OpenWeatherMap API and delivers it to clients via a gRPC interface.
- GetCurrentWeather: An RPC call that returns current weather details for a given latitude and longitude.
- Uses OpenWeatherMap API for accurate and real-time weather data.
- Built-in error handling for various scenarios like invalid geocoordinates, network errors, etc.
- Easily extensible to support more features like forecasts, historical data, etc.
- Python 3.8+
- gRPC and Protocol Buffers
- OpenWeatherMap API Key
- Poetry: Dependency management tool for Python.
-
Clone the repository:
git clone https://github.com/connorjcantrell/grpc_weather_service.git cd grpc_weather_service
-
Install required dependencies using Poetry:
poetry install
-
Activate the poetry environment:
poetry shell
-
Set the OpenWeatherMap API key as an environment variable:
export WEATHER_API_KEY=your_api_key
-
Start the gRPC server:
python server/main.py
-
[Optional] To test, you can create a gRPC client and make a
GetCurrentWeather
request tolocalhost:50051
.
To add more features, such as forecasts:
- Update the
weather.proto
file with new service definitions. - Regenerate the gRPC code using the Protocol Buffers compiler.
- Implement the new service in the server code.
- API Limitations: The service relies on OpenWeatherMap, which might have rate limits based on your subscription.
This project is licensed under the MIT License. See the LICENSE.md
file for the full text.