A 30-Day Weather Dashboard: How I Built A Python Project for API Integration and Cloud Storage
Overview
The 30days Weather Dashboard is a Python-based application designed to fetch weather data for multiple cities using the OpenWeather API. It saves the fetched weather data to an AWS S3 bucket for storage, demonstrating best practices in API integration, cloud resource management, and secure credentials handling.
Features
Fetches real-time weather data for specified cities.
Displays temperature, humidity, and weather conditions.
Saves weather data securely to an AWS S3 bucket.
Implements error handling for API and cloud service interactions.
Technologies Used
Programming Language: Python
API Service: OpenWeather API
Cloud Service: AWS S3
Libraries:
boto3
for AWS interactionsrequests
for HTTP requests to the OpenWeather APIdotenv
for managing environment variables
Project Structure
weather-dashboard/
src/
__init__.py
weather_dashboard.py
tests/
data/
.env
.gitignore
requirements.txt
File Descriptions
src/weather_dashboard.py
: Main script for fetching weather data and interacting with AWS S3..env
: Stores sensitive credentials such as API keys and AWS bucket names.requirements.txt
: Lists the dependencies required for the project.
Setup Instructions
Prerequisites
Ensure the following are installed:
Python 3.8+
AWS CLI
Git
Steps
- Clone the repository:
git clone https://github.com/onlyfave/30days-weather-dashboard.git
cd 30days-weather-dashboard
- Install dependencies:
pip install -r requirements.txt
- Configure environment variables in a
.env
file:
OPENWEATHER_API_KEY=01a1ec452e4adb14c36d7121723ddc04
AWS_BUCKET_NAME=weather-dashboard
AWS_DEFAULT_REGION=us-east-1
4. Configure AWS credentials:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
aws configure
5 .Run the application:
python3 src/weather_dashboard.py
Screenshots
- Application Output:
- AWS S3 Bucket Configuration:
- Error Handling:
- AWS S3 Output:
What I Learned
AWS S3 Bucket Management: Creating, managing, and integrating S3 buckets with Python.
Secure Credential Handling: Using environment variables to manage sensitive information securely.
API Integration: Best practices for consuming external APIs in Python.
Error Handling: Managing and logging errors in distributed systems.
Git Workflow: Managing version control for project development.
Future Enhancements
Add weather forecasting for upcoming days.
Implement a graphical user interface (GUI) for better usability.
Integrate advanced data visualizations using libraries like Matplotlib or Plotly.
Expand support for more cities and internationalization.
Automate testing using frameworks like Pytest.
Set up a CI/CD pipeline for streamlined deployments.
Acknowledgements
Special thanks to:
The DevOps and Python communities for their invaluable resources.
OpenWeather for providing weather data.
AWS for cloud storage and infrastructure.
Contact
For any questions or feedback, feel free to reach out:
LinkedIn: Onyeneke Favour
GitHub: onlyfave