GithubHelp home page GithubHelp logo

anoushkamishra2803 / weather-forecasting-tool-using-api Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 6 KB

A command-line tool that accepts a city's name and returns the current weather forecast. Leverage OpenWeatherMap API to fetch weather data and parse it using Python. Demonstrate how GitHub Copilot can help us with API usage, data parsing, and error handling.

Python 100.00%

weather-forecasting-tool-using-api's Introduction

Weather-Forecasting-Tool-using-API

A command-line tool that accepts a city's name and returns the current weather forecast. Leverage OpenWeatherMap API to fetch weather data and parse it using Python. Demonstrate how GitHub Copilot can help us with API usage, data parsing, and error handling.

Prerequisites

  • Python 3.x
  • requests library

Getting Started

  1. Clone the repository or copy the script into your local environment.

  2. Install the required dependencies. Open a terminal or command prompt and run the following command:

pip install requests

  1. Obtain an API key from OpenWeatherMap by creating an account on their website.

  2. Open the script in a text editor or Python IDE.

  3. Locate the following line of code: ```python API_KEY = "11d9310e526c7fb43fc68cdfbf744078"

  4. Replace "11d9310e526c7fb43fc68cdfbf744078" with your actual OpenWeatherMap API key.

Run the script.

python weather_forecast.py

  1. Enter the name of the city for which you want to retrieve the weather forecast when prompted.

  2. The script will make an API request to OpenWeatherMap and display the temperature, humidity, pressure, and weather description for the specified city.

EXAMPLE OUTPUT

image

Troubleshooting

If you encounter an error in the HTTP request, ensure that you have entered a valid API key and that you have an active internet connection.

If the API request fails, double-check the city name you entered and ensure it is spelled correctly.

--------------------------------------------------------------THANK YOU-----------------------------------------------------------------------------

weather-forecasting-tool-using-api's People

Contributors

anoushkamishra2803 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.