weather_forecast

Crates.ioweather_forecast
lib.rsweather_forecast
version0.3.0
sourcesrc
created_at2024-01-28 19:14:53.390966
updated_at2024-01-28 20:16:55.611901
descriptiona basic project to determine the weather of different cities
homepagehttps://github.com/tusharpamnani/Weather-Forecast
repositoryhttps://github.com/tusharpamnani/Weather-Forecast
max_upload_size
id1117803
size43,887
Tushar Pamnani (tusharpamnani)

documentation

README

Weather Forecast CLI

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.

Prerequisites

  • Rust: Make sure you have Rust installed on your system.

Installation

Clone the repository:

git clone https://github.com/tusharpamnani/Weather-Forecast.git
cd Weather-Forecast

Build the project:

cargo build --release

Usage

  1. 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",
    
  2. 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
    

Output

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

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • OpenWeatherMap for providing the weather forecast data through their API.
  • reqwest for HTTP client functionality.
  • serde for serialization and deserialization of JSON data.
  • structopt for easy command-line argument parsing.
Commit count: 0

cargo fmt