DEV Community

Ameh Mathias Ejeh
Ameh Mathias Ejeh

Posted on

4 2 1 2 2

Building a Weather Dashboard using S3, Python and OpenWeather API

Overview

This Project is a Python-based application designed to interact with the OpenWeather API to fetch and display real-time weather data. This project demonstrates how to consume a third-party API, handle HTTP requests, process JSON responses, and present weather data in a user-friendly manner.

Features

  • Retrieve current weather data for a specified location.
  • Display weather details such as temperature, humidity, wind speed, and weather conditions.
  • Automatically stores weather data in AWS S3
  • Supports multiple cities tracking
  • Timestamps all data for historical tracking
  • Handle errors gracefully, including invalid API keys, network issues, and unsupported locations.

Prerequisites

Before running this project, ensure the following requirements are met:

  • AWS Account
  • Python 3.8.10 installed on your system.
  • An active OpenWeather API key.
  • Required Python packages installed.

Project Structure

Open-Weather-API-Project/
├── src/
├── init.py # Package initializer
├── weather_dashboard.py # Main script to run the application
├── .gitignore # Git ignore file
├── README.md # Project documentation
├── requirements.txt # Python dependencies

Architecture Diagram

Image description

Setup Instructions

  • clone the repository:
git clone https://github.com/ameh0429/Open-Weather-API-Project.git
 cd Open-Weather-API-Project
Enter fullscreen mode Exit fullscreen mode
  • Install Dependencies
pip install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode

Image description
The error indicates a dependency conflict between the version of request I specified (2.28.2) and the version required by jupyterlab-server (>=2.31)

Step to fix

since jupyterlab-server requires requests>=2.31, I upgraded requests to a version that satisfies this requirement by runnig this command:

pip install "requests>=2.31"
Enter fullscreen mode Exit fullscreen mode

Image description

  • Configure environment variables (.env)
OPENWEATHER_API_KEY=your_api_key
AWS_BUCKET_NAME=your_bucket_name
Enter fullscreen mode Exit fullscreen mode
  • Configure AWS credentials:
aws configure
Enter fullscreen mode Exit fullscreen mode

Image description

  • Insert the python script in the weather_dashboard.py file

Image description
This Python script is building a class named WeatherDashboard to:

  1. Fetch environment variables using dotenv for API keys and S3 bucket names.
  2. Use boto3 (AWS SDK for Python) to interact with AWS S3.
  3. Set up functionality to fetch weather data, process it, and store it in an S3 bucket
  • Run the application:
python src/weather_dashboard.py
Enter fullscreen mode Exit fullscreen mode

Image description

  • Confirm the weather data in S3 bucket

Image description

  • Future Improvements
  1. Add support for extended forecasts (e.g., 7-day weather data).
  2. Implement unit tests for better code coverage.
  3. Enable geolocation-based weather fetching.

Neon image

Build better on Postgres with AI-Assisted Development Practices

Compare top AI coding tools like Cursor and Windsurf with Neon's database integration. Generate synthetic data and manage databases with natural language.

Read more →

Top comments (0)

Image of Quadratic

Python + AI + Spreadsheet

Chat with your data and get insights in seconds with the all-in-one spreadsheet that connects to your data, supports code natively, and has built-in AI.

Try Quadratic free

👋 Kindness is contagious

Value this insightful article and join the thriving DEV Community. Developers of every skill level are encouraged to contribute and expand our collective knowledge.

A simple “thank you” can uplift someone’s spirits. Leave your appreciation in the comments!

On DEV, exchanging expertise lightens our path and reinforces our bonds. Enjoyed the read? A quick note of thanks to the author means a lot.

Okay