Summary: A professional, real-time news application that fetches and filters headlines across categories and sources. Built to showcase modern Python web development, API integration, and clean UI/UX in a portfolio-ready app.
Stack: Python Β· Streamlit Β· NewsAPI Β· Requests Β· python-dotenv Β· pandas
π― What This App Does (at a glance)
- Real-time news: Pulls the latest headlines by category.
- Smart search: Query across all sources (e.g., βAIβ, βinflationβ).
- Source explorer: Browse sources per category with descriptions and links.
- Polished UI: Responsive layout with sidebar controls and custom styling.
- Resilient: Graceful error handling (timeouts, missing keys, bad responses).
- Tunable: Choose how many articles to display (e.g., 5β50).

π§© Why I Built It
I wanted a compact project that demonstrates:
- API integration end-to-end (auth, params, pagination guards, status handling).
- Interactive UX with Streamlit (sidebar configs, dynamic results).
- Clean code structure (separating UI from business logic).
- Deployability (local + Streamlit Cloud / Docker options).
π οΈ Technologies
- Python 3.8+
- Streamlit for the interactive web app
- NewsAPI for live data
- Requests for HTTP calls
- python-dotenv for environment variables
- pandas for light transformation/formatting
π¦ Project Structure
Port/
βββ streamlit_news_app.py # UI: Streamlit app (layout, controls, display)
βββ news_automator.py # Logic: API calls, validation, error handling
βββ requirements.txt # Dependencies
βββ .env # Environment variables (create this locally)
βββ README.md # Project documentation
βοΈ Setup (Local)
- Clone
git clone <your-repo-url>
cd Port
- Install deps
pip install -r requirements.txt
- Configure env
Create a .env
file in the project root:
API_KEY=your_news_api_key_here
Get a free API key from NewsAPI.org.
- Run
streamlit run streamlit_news_app.py
Then open http://localhost:8501
π Usage
- Browse by category: Business, Entertainment, General, Health, Science, Sports, Tech
- Search: Enter keywords (βAI regulationβ, βinterest ratesβ), fetch relevant articles.
- View sources: Explore available sources per category with links and descriptions.
β Set number of results, click Fetch News.
UI niceties
- Responsive layout, sidebar configuration
- Friendly error messages (API limits, network errors)
- Portfolio panel (tech stack, links, instructions)
π§ Core Functions (from news_automator.py
)
get_articles_by_category(category, max_articles=20)
β top headlines for a categoryget_articles_by_query(query, max_articles=20)
β search across sourcesget_news_sources(category)
β list sources + metadata
Built-in validation & error handling (HTTP status checks, empty results, API key checks).
ποΈ Architecture & Design Choices
Separation of concerns
- UI (Streamlit) in
streamlit_news_app.py
- Business logic (API calls, parsing) in
news_automator.py
Reliability
- Try/except wrappers around API calls
- Clear user messages for rate limits / invalid keys / no results
- Configurable page size to avoid API overload
UX
- Minimal clicks to value (category β fetch β read)
- Clean card-style article blocks with title, description, source, link
- Consistent typography and spacing for readability
π Secrets & Config
- API key stored in
.env
via python-dotenv - Never hard-code keys; ignore
.env
in version control - Ready for Streamlit Cloud secrets if deploying there
π Deployment Options
- Local:
streamlit run streamlit_news_app.py
- Streamlit Cloud: Push to GitHub β set
API_KEY
as a secret β deploy - Docker (optional): Containerise for portability
- Heroku / AWS / GCP / Azure: As a simple Python web service
β What I Learned
- Designing a small but solid app thatβs easy to read and extend
- Handling the realities of rate limits / timeouts / empty payloads
- Creating a professional UI quickly with Streamlit
- Packaging portfolio projects with clear docs and clean structure
π Roadmap / Improvements
- Saved Searches & Bookmarks: Persist favourite topics
- Multi-API fallback: If NewsAPI rate-limits, degrade gracefully
- Scheduling & Caching: Faster reloads + fewer API calls
- Topic modeling: Cluster related news (NLP)
- Email/Slack digests: Daily/weekly summaries for selected topics
- Dark mode toggle and theme presets
π Links
- Live Demo: (add link if deployed)
- GitHub Repo: π° News Automator β Real-Time News Aggregator (Python + Streamlit)
- Contact: info@adeyanjuteslim.co.uk
π§Ύ SEO (for this page)
- Title: News Automator β Real-Time News Aggregator (Python + Streamlit)
- Meta Description: A portfolio project by Teslim Adeyanju: real-time news app built with Python, Streamlit, and NewsAPI β featuring smart search, source browser, and a clean responsive UI.
π Badge (optional Notion block)
Status: Live β’ Tech: Python, Streamlit, NewsAPI β’ Focus: API integration, UI/UX, Error handling
Β© Teslim Adeyanju 2025. All Rights Reserved.