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
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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7520457ae236c260c5d1acdf7b452d309984e00931dd5772ba728215c20763cd
|
|
| MD5 |
6ebde6d64568940627a59dc9657b8c69
|
|
| BLAKE2b-256 |
a523b4e8da9afa57dc9afba9996138798d9cc75f59e7cad6b2deb6e894c4263a
|
Provenance
The following attestation bundles were made for scoutrss-0.1.1.tar.gz:
Publisher:
publish.yml on viperadnan-git/scoutrss
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scoutrss-0.1.1.tar.gz -
Subject digest:
7520457ae236c260c5d1acdf7b452d309984e00931dd5772ba728215c20763cd - Sigstore transparency entry: 1004335096
- Sigstore integration time:
-
Permalink:
viperadnan-git/scoutrss@face633887de34213ef8cffd17fb01a28591f3c4 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/viperadnan-git
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@face633887de34213ef8cffd17fb01a28591f3c4 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4769ea4927ca809b2959095b1d5187a4b48caaf9030bd8af7716bddbcd83b11a
|
|
| MD5 |
a0a045400a48a3a8725c0c97039db0bc
|
|
| BLAKE2b-256 |
bfdca157aa752352a59adacccdf7c594fe0301cefdab8351518b9850bf614b47
|
Provenance
The following attestation bundles were made for scoutrss-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on viperadnan-git/scoutrss
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scoutrss-0.1.1-py3-none-any.whl -
Subject digest:
4769ea4927ca809b2959095b1d5187a4b48caaf9030bd8af7716bddbcd83b11a - Sigstore transparency entry: 1004335100
- Sigstore integration time:
-
Permalink:
viperadnan-git/scoutrss@face633887de34213ef8cffd17fb01a28591f3c4 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/viperadnan-git
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@face633887de34213ef8cffd17fb01a28591f3c4 -
Trigger Event:
push
-
Statement type: