Skip to main content

A library for watching RSS feeds and notifying when new entries are available

Project description

ScoutRSS

ScoutRSS is a Python package for monitoring RSS feeds and triggering callbacks when new entries are found. It uses the feedparser package to parse RSS feeds and the APScheduler package to schedule checks at regular intervals.

Installation

To install ScoutRSS, use pip:

pip install scoutrss

Usage

To use ScoutRSS, create an instance of the ScoutRSS class and pass in the RSS feed URL, a callback function to be called when new entries are found, and other optional parameters.

from scoutrss import ScoutRSS

def callback(entries):
    print("Found {} new entries".format(len(entries)))

watcher = ScoutRSS("http://example.com/feed.xml", callback)
watcher.listen()

This will start monitoring the RSS feed and calling the callback function whenever new entries are found. The listen method starts the scheduler with a default interval of 60 seconds. You can customize the interval by passing a different value to the interval parameter:

watcher.listen(interval=120)  # Check every 2 minutes

You can also use the stop_listener method to stop monitoring the RSS feed:

watcher.stop_listener()

Advanced usage

You can use the check_confirmation parameter to control whether to update the last saved on timestamp based on the return value of the callback function. If set to True, the callback function should return True to update the last saved on timestamp:

from scoutrss import ScoutRSS

def callback(entries):
    for entry in entries:
        print("Found new entry: {}".format(entry.title))
    return True

watcher = ScoutRSS("http://example.com/feed.xml", callback, check_confirmation=True)
watcher.listen()

You can also use the id parameter to specify a unique ID for the RSS feed. This can be useful if you want to monitor multiple RSS feeds with different callback functions:

watcher1 = ScoutRSS("http://example1.com/feed.xml", callback1, id="feed1")
watcher2 = ScoutRSS("http://example2.com/feed.xml", callback2, id="feed2")

By default, the last saved on timestamp is stored in a pickledb database file named scoutrss.data.json in the current directory. You can customize the database file path by passing a different value to the load method of the pickledb package:

import pickledb

db = pickledb.load("custom/path/to/database.json", True)
watcher = ScoutRSS("http://example.com/feed.xml", callback, db=db)

You can also pass in a custom scheduler instance if you want to use a different scheduler:

from apscheduler.schedulers.asyncio import AsyncIOScheduler

scheduler = AsyncIOScheduler()
watcher = ScoutRSS("http://example.com/feed.xml", callback, apscheduler=scheduler)

License

ScoutRSS is licensed under the GNU v3 license. See the LICENSE file for more information.

Contributing

Contributions are welcome! See the CONTRIBUTING.md file for more information.

Credits

ScoutRSS was created by Adnan Ahmad and licensed under the GNU GPLv3 license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scoutrss-0.1.1.tar.gz (67.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scoutrss-0.1.1-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file scoutrss-0.1.1.tar.gz.

File metadata

  • Download URL: scoutrss-0.1.1.tar.gz
  • Upload date:
  • Size: 67.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for scoutrss-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7520457ae236c260c5d1acdf7b452d309984e00931dd5772ba728215c20763cd
MD5 6ebde6d64568940627a59dc9657b8c69
BLAKE2b-256 a523b4e8da9afa57dc9afba9996138798d9cc75f59e7cad6b2deb6e894c4263a

See more details on using hashes here.

Provenance

The following attestation bundles were made for scoutrss-0.1.1.tar.gz:

Publisher: publish.yml on viperadnan-git/scoutrss

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scoutrss-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: scoutrss-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for scoutrss-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4769ea4927ca809b2959095b1d5187a4b48caaf9030bd8af7716bddbcd83b11a
MD5 a0a045400a48a3a8725c0c97039db0bc
BLAKE2b-256 bfdca157aa752352a59adacccdf7c594fe0301cefdab8351518b9850bf614b47

See more details on using hashes here.

Provenance

The following attestation bundles were made for scoutrss-0.1.1-py3-none-any.whl:

Publisher: publish.yml on viperadnan-git/scoutrss

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page