Python client for RSS Reader API
Project description
RSS Reader Client
A modern Python client library for the RSS Reader API.
Features
- Full-featured client for the RSS Reader API
- Type hints for better IDE integration
- Comprehensive data models with proper typing
- Clean error handling with specific exceptions
- Simple and intuitive interface
Installation
pip install rssreader-client
Quick Start
from rssreader import RSSClient
# Initialize the client
client = RSSClient("http://localhost:5000", "your-api-key")
# Get all categories
categories = client.get_categories()
for category in categories:
print(f"{category.id}: {category.title} ({category.feed_count} feeds)")
# Get all feeds
feeds = client.get_feeds()
for feed in feeds:
print(f"{feed.id}: {feed.title}")
# Get entries from a specific feed
result = client.get_feed_entries(feed_id=1)
for entry in result["entries"]:
print(f"{entry.title} - {entry.published_at}")
# Get a specific entry with content
entry = client.get_entry(entry_id=42)
print(f"Title: {entry.title}")
print(f"Content: {entry.content[:100]}...") # Show first 100 chars
Documentation
Client Class
RSSClient(base_url, api_key)
The main client for interacting with the RSS Reader API.
base_url: Base URL of the RSS Reader API (e.g., "http://localhost:5000")api_key: API key for authentication
Methods
get_categories()- Get all categoriesget_feeds(category_id=None)- Get all feeds, optionally filtered by categoryget_entries(page=1, per_page=50, category_id=None, feed_id=None)- Get entries with paginationget_category_entries(category_id, page=1, per_page=50)- Get entries for a specific categoryget_feed_entries(feed_id, page=1, per_page=50)- Get entries for a specific feedget_entry(entry_id)- Get a specific entry with contentget_status()- Get system statusget_task_status()- Get background task status
Data Models
Category- Represents a feed categoryFeed- Represents an RSS feedEntry- Represents a feed entry with contentSystemStatus- System status informationTaskStatus- Background task statusPagination- Pagination information
Exception Classes
RSSReaderException- Base exceptionAPIError- API errors with status codesAuthenticationError- Authentication failuresConnectionError- Connection issues
Examples
Listing Categories and Feeds
from rssreader import RSSClient
client = RSSClient("http://localhost:5000", "your-api-key")
# Get all categories
categories = client.get_categories()
print(f"Found {len(categories)} categories:")
for category in categories:
print(f" - {category.title} ({category.feed_count} feeds)")
# Get feeds in this category
feeds = client.get_feeds(category_id=category.id)
for feed in feeds:
print(f" - {feed.title} ({feed.entry_count} entries)")
Working with Entries
from rssreader import RSSClient
from datetime import datetime, timedelta
client = RSSClient("http://localhost:5000", "your-api-key")
# Get recent entries (last 7 days)
result = client.get_entries(per_page=100)
entries = result["entries"]
# Filter for entries in the last 7 days
one_week_ago = datetime.now() - timedelta(days=7)
recent_entries = []
for entry in entries:
published = entry.published_datetime()
if published and published > one_week_ago:
recent_entries.append(entry)
print(f"Found {len(recent_entries)} entries from the last 7 days:")
for entry in recent_entries[:5]:
print(f" - {entry.title}")
print(f" Published: {entry.published_at} | Feed: {entry.feed.get('title')}")
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rssreader_client-1.0.tar.gz
(8.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rssreader_client-1.0.tar.gz.
File metadata
- Download URL: rssreader_client-1.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e949bb3c8bc6826504312a7431661d82ebef24c7a22aba7d119ec875296c99d
|
|
| MD5 |
333de6a2a9a2ec76cc11bb0ca42985ec
|
|
| BLAKE2b-256 |
02cc08304419aba2c8881e12c8bcd5394391b7a15d690fec69593f49fe10aca8
|
File details
Details for the file rssreader_client-1.0-py3-none-any.whl.
File metadata
- Download URL: rssreader_client-1.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2723ed64b8b8e1733137b4c06b747f61007a9f5189f3891d7c4123c31a121ab
|
|
| MD5 |
78319d4317cfcd489ae3bdfa55ff19a0
|
|
| BLAKE2b-256 |
1d334f96dd541f7eeaad1676a93544555c3c0867706592eca4ff70b6d48ec655
|