https://github.com/nazneenprojects/news_api_rate_limiting
This project focuses on implementation of News API Rate limiting usigng FastAPI, Asyncio, SQLModel
https://github.com/nazneenprojects/news_api_rate_limiting
asyncio fastapi rate-limiting sqlmodel
Last synced: about 1 month ago
JSON representation
This project focuses on implementation of News API Rate limiting usigng FastAPI, Asyncio, SQLModel
- Host: GitHub
- URL: https://github.com/nazneenprojects/news_api_rate_limiting
- Owner: nazneenprojects
- License: mit
- Created: 2025-05-06T08:34:56.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-05-08T10:42:48.000Z (about 1 year ago)
- Last Synced: 2025-06-14T05:35:05.457Z (12 months ago)
- Topics: asyncio, fastapi, rate-limiting, sqlmodel
- Language: Python
- Homepage:
- Size: 891 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# news_api_rate_limiting
This project focuses on implementation of News API Rate limiting usigng FastAPI, Asyncio, SQLModel
## Project Summary: Async News Fetcher with Rate Limiting
### Features:
- Fetch 20 news articles from NewsAPI.org (external API) and store them into PostgreSQL.
- Serve local news data via FastAPI, with a rate limit of 5 fetches per day per IP.
### Tech Stack:
| Component | Tool |
| -------------------------- | ------------------------------------------- |
| API server | FastAPI |
| Async support | `httpx`, `
`, `asyncio` |
| Database | PostgreSQL (accessed via `asyncpg`) |
| ORM (optional but helpful) | `SQLModel` or `SQLAlchemy` (async mode) |
| Rate Limiting | `slowapi` (Flask-style limiter for FastAPI) |
| Environment variables | `python-dotenv` |
### Run
uvicorn app.main:app --reload
### Testing
curl http://localhost:8000/news
### Future Improvements
Add user registration/auth with rate limit per user instead of IP
Store full request logs and timestamps
Add endpoint to trigger news fetch manually (POST /fetch-news)
Add pagination or search filters
Bug Fix : duplication issue
### Output snaps



