Skip to main content

rsstools

A powerful Python tool for creating, editing, and managing RSS feeds with both programmatic and command-line interfaces.

Features

  • Create new RSS feeds with all required elements
  • Add, update, and remove items from feeds
  • Load and save RSS feeds to XML files
  • Validate feed structure and required elements
  • Command-line interface for easy management
  • Support for optional elements like author and publication date

Installation

Dependencies

First, ensure you have Python 3.7 or higher installed. This package requires the following dependencies:

click>=8.0.0

Installing via pip (recommended)

  1. Run this command:
pip install rsstools

Using via pyz

  1. Download the latest pyz from the releases tab.
  2. Make the file executable:
chmod +x rsstools.pyz
  1. You can run it directly:
python rsstools.pyz

If you need to extract the contents:

unzip rsstools.pyz -d rsstools_extracted
cd rsstools_extracted

Installing from source

This package requires the following dependencies:

click>=8.0.0
  1. Clone the repository:
git clone https://github.com/sctech-tr/rsstools.git
cd rsstools
  1. Install the package:
pip install .

Usage

Command Line Interface

  1. Create a new RSS feed:
rsstools create -t "My Blog" -l "https://myblog.com" -d "My personal blog" -o feed.xml
  1. Add an item to the feed:
rsstools add feed.xml \
-t "First Post" \
-l "https://myblog.com/first" \
-d "My first post" \
-a "John Doe" \
-p "2024-10-18T12:00:00"
  1. List all items in a feed:
rsstools list feed.xml
  1. Export items to JSON:
rsstools list feed.xml -o items.json
  1. Update an item:
rsstools update feed.xml "https://myblog.com/first" -t "Updated Post Title"
  1. Remove an item:
rsstools remove feed.xml "https://myblog.com/first"

Python API

from rsstools import RSSFeedCreator
from datetime import datetime

# Create a new feed
feed = RSSFeedCreator(
    title="My Blog",
    link="https://myblog.com",
    description="My personal blog about technology"
)

# Add an item
feed.add_item(
    title="First Post",
    link="https://myblog.com/first-post",
    description="This is my first blog post",
    author="John Doe",
    pub_date=datetime.now()
)

# Save the feed
feed.save("blog_feed.xml")

# Load an existing feed
feed.load("blog_feed.xml")

# Update an item
feed.update_item(
    guid="https://myblog.com/first-post",
    title="Updated First Post"
)

# Remove an item
feed.remove_item(guid="https://myblog.com/first-post")

# Get all items
items = feed.get_items()

Contributing

  1. Fork the repository
  2. Open a PR

License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details.

Error Handling

The package uses custom exceptions (RSSToolsError) for error handling. Always wrap your code in try-except blocks when using the API:

from rsstools import RSSFeedCreator, RSSToolsError

try:
    feed = RSSFeedCreator("My Blog", "https://myblog.com", "My blog description")
    feed.save("feed.xml")
except RSSToolsError as e:
    print(f"Error: {str(e)}")

Common Issues and Solutions

  1. Invalid Feed Structure: Ensure your RSS feed follows the standard RSS 2.0 format.
  2. File Permissions: Make sure you have write permissions in the directory where you're saving the feed.
  3. Date Format: When using the CLI, provide dates in ISO format (YYYY-MM-DDTHH:MM:SS).

Getting Help

Use the --help flag with any command to see available options:

rsstools --help
rsstools create --help
rsstools add --help

Metadata

Release files for rsstools 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rsstools 0.3.1
File Size Uploaded
rsstools-0.3.1.tar.gz 19.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rsstools 0.3.1
File Interpreter ABI Platform
rsstools-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 38.5 kB

Release files / rsstools-0.3.1.tar.gz

Download URL rsstools-0.3.1.tar.gz
Size 19.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0d1b67e04695adf47d71a7155b0d266e7d640a283a4a8d236e04360206070098
BLAKE2b-256 checksum
How to use checksums
9b72e6b2573becc63d199e31ec27718c1b36605e1a551eb405750d3149d7d119
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.13.0

Release files / rsstools-0.3.1-py3-none-any.whl

Download URL rsstools-0.3.1-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79c9d1d2ecab0dce9d387349f346cea77631d9c43f06730b35d94af270fede7a
BLAKE2b-256 checksum
How to use checksums
08d1df0eda8223e8bcbbd02e3345092bcd28a7f8aac82b5fba2f09a1f0a2a21f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.13.0

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page