Crates.io | weather_forecast |
lib.rs | weather_forecast |
version | 0.3.0 |
source | src |
created_at | 2024-01-28 19:14:53.390966 |
updated_at | 2024-01-28 20:16:55.611901 |
description | a basic project to determine the weather of different cities |
homepage | https://github.com/tusharpamnani/Weather-Forecast |
repository | https://github.com/tusharpamnani/Weather-Forecast |
max_upload_size | |
id | 1117803 |
size | 43,887 |
This is a simple command-line interface (CLI) application that fetches weather forecast data from the OpenWeatherMap API based on the provided city and country code.
Clone the repository:
git clone https://github.com/tusharpamnani/Weather-Forecast.git
cd Weather-Forecast
Build the project:
cargo build --release
Add your API key: Open the src/main.rs
file and add your OpenWeatherMap API key to the following line (line 89):
"https://api.openweathermap.org/data/2.5/weather?q={},{}&appid={YOUR_API_KEY}&units=metric",
Run the CLI:
cargo run <CITY> <COUNTRY_CODE>
Replace <CITY>
with the name of the city and <COUNTRY_CODE>
with the country code (e.g., "ind" for India).
Example:
cargo run nagpur ind
The CLI will display information about the provided city's weather forecast, including temperature, description, humidity, wind speed and direction, and sunrise/sunset times.
Example output:
Weather forecast for Nagpur (IND):
- Temperature: 19.01 °C
This project is licensed under the MIT License - see the LICENSE file for details.