0% found this document useful (0 votes)
15 views1 page

Python Weather Report with API Integration

Uploaded by

rsg189423114
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

Python Weather Report with API Integration

Uploaded by

rsg189423114
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Assignment Title: Weather Report Using Python

Objective:
The purpose of this assignment is to create a Python program that fetches and
displays real-time weather data for a user-specified city using the OpenWeatherMap
API.

Tools & Technologies Used:


- Programming Language: Python
- API Used: OpenWeatherMap
- Library: requests (for handling HTTP requests)

Program Overview:
This program asks the user to input a city name. It then connects to the
OpenWeatherMap API and retrieves the current weather data for that city. The data
includes:
- City and Country
- Temperature and Feels Like Temperature
- Weather Description (e.g., Clear sky, Rainy)
- Humidity Level

The results are printed in a user-friendly format with relevant icons and messages.

Key Features:
- Real-time weather updates
- User input-based city selection
- Error handling for invalid city names or API issues
- Output in human-readable and clean format

Code Explanation:
- The function get_weather(city) takes a city name as input.
- It sends a request to the OpenWeatherMap API using the provided API key.
- The JSON response is parsed to extract necessary weather details.
- A formatted weather report is printed.
- The program includes a try-except block for handling any unexpected errors.

Conclusion:
This program is a practical example of how Python can be used to work with web APIs
and display real-time data. It enhances understanding of HTTP requests, JSON
parsing, and user interaction via console.

You might also like