Skip to content

Commit 81cf71a

Browse files
committed
feat: validate_feed now returns the feed on success
1 parent 339a0cf commit 81cf71a

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

example/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "django-rss-filter"
3-
version = "0.7.0"
3+
version = "0.8.0"
44
description = "Filter public RSS feeds, remove articles that contain certain keywords or categories."
55
authors = [
66
{name = "Kevin Renskers", email = "kevin@loopwerk.io"},

rssfilter/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import feedparser
22
import httpx
33
from feedgen.feed import FeedGenerator
4+
from feedparser import FeedParserDict
45
from httpx import ConnectError, ConnectTimeout
56

67
from . import USER_AGENT
78

89

9-
def validate_feed(feed_url: str) -> tuple[bool, str]:
10+
def validate_feed(feed_url: str) -> tuple[bool, str | FeedParserDict]:
1011
try:
1112
# Fetch content using httpx rather than having feedparser do this,
1213
# since we can't set a timeout with feedparser. It also makes sure
@@ -18,7 +19,7 @@ def validate_feed(feed_url: str) -> tuple[bool, str]:
1819
version = feed.get("version", "")
1920
if not version:
2021
return False, "This doesn't seem to be a valid RSS or Atom feed"
21-
return True, ""
22+
return True, feed
2223
except ValueError:
2324
return False, "This doesn't seem to be a valid RSS or Atom feed"
2425
except ConnectTimeout:

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)